Minor Changes
-
#5106
db3aa05Thanks @ascorbic! - Adds adelayWhenUnsentoption to the config ofsendMagicLink()andrequestSignup(). It defaults totrue, which keeps the existing 100-250 ms wait before resolving when nothing is sent. Set it tofalsewhen you run the call after your response has been sent, for example withafter()fromemdash, so the deferred task doesn't wait for nothing. -
#4686
91dfa31Thanks @ascorbic! - Adds editorial comments: threads that staff leave on an entry while reviewing it, separate from the public comments visitors post.A thread points at the whole entry, a field, a Portable Text block, or a range of text in a block, and holds a conversation that can be resolved and reopened. Threads are private to staff and never appear on the site.
In the entry editor, select text in any Portable Text field and choose Comment in the formatting toolbar, or press ⌘⌥M (Ctrl+Alt+M), to start a thread beside it. To comment on an image, embed, divider or other non-text block, choose Comment in its block menu (or, without edit access, select the block and choose Comment in the toolbar above it), and to comment on a whole field, use the comment button at the end of the field's label row. The comment button in the editor bar, just before the settings panel toggle, shows or hides the margin and shows how many threads are open. Commenting needs no edit access: Contributors who can't edit an entry, and anyone viewing an entry while someone else holds its edit lock, can still select text and comment. Commented text stays highlighted as you edit, and a thread whose text was deleted is listed as detached with the text it referred to. Links of the form
?thread=<id>open the editor with that thread selected and its text in view, and Go to text on an open thread selects the text it refers to.The API lives under each entry, at
/_emdash/api/content/{collection}/{id}/threads, with routes to list and start threads, reply, edit and delete comments, resolve and reopen threads, and store anchors after the entry's content changes. Each thread and comment in a response carriescanflags that say what the caller may do with it.Mentions and email
Type
@in a comment to mention someone who can take part in threads. A comment body stores each mention as<@USER_ID>, and every thread in a response lists the users it mentions undermentions, with their current names, so a renamed user shows the new name.GET …/threads/mentionable?q=returns up to 10 people to mention, matched by display name, without email addresses. A new comment, or an edit that adds a mention, fails withVALIDATION_ERRORwhen it mentions a user who doesn't exist or can't take part. Mentions already in a comment don't stop it being edited.When the site has an email provider, a new comment emails the people it mentions, the thread's creator and the authors of its earlier comments that weren't deleted, except its own author, anyone who can no longer take part, and users whose email address isn't verified. Editing a comment to mention someone new emails only that person. The email has the entry's title, an excerpt of the comment and a link to the thread. Without an email provider, nothing is sent, and the comment is still saved. See Comment on an entry for mentions and comment emails.
MCP tools
AI agents can review entries through five MCP tools:
editorial_thread_list,editorial_mentionable_list,editorial_thread_create,editorial_comment_createandeditorial_thread_resolve. A token needs thecontent:readscope foreditorial_thread_listandeditorial_mentionable_list, and thecontent:writescope for the other three.editorial_mentionable_listfinds the user IDs that comment bodies mention as<@USER_ID>. The user behind the token needs theeditorial:commentandcontent:read_draftspermissions for every tool.editorial_thread_createstarts a thread on the whole entry, or on one field when you passfield. To comment on specific text, passfieldand the exactquote, with optionalprefixandsuffixto tell repeated text apart. The tool finds the quote in the entry's current draft. Passingprefixorsuffixwithoutquotefails withVALIDATION_ERROR.Visual editing
Editors can review threads on the site itself. In edit mode, each element bound with
{...entry.edit}or{...entry.edit.field}shows a badge with the number of its open threads; threads on text and blocks in a field count toward that field's badge, and threads on a field the page doesn't show count toward the entry's badge. Hover over or tab to a bound element to show its comment button, which opens a popover where you can reply, resolve a thread you're allowed to resolve, follow Open in admin, and start a new thread on the entry or field.A Portable Text field rendered with
<PortableText>in edit mode gets a badge of its own even when no element around it is bound with{...entry.edit.field}. Its text and block threads are highlighted in the page editor, and clicking a highlight opens a popover next to it with just the threads on that text while the cursor stays in the text, and the field's badge still lists all of them; press ⌘⌥M (Ctrl+Alt+M) in a highlight to move to its reply box instead. To start a thread on text, select it and choose Comment in the formatting toolbar, or press ⌘⌥M (Ctrl+Alt+M). When you edit text that a thread points at, the thread moves with it on the next save. The page editor now keeps each block's_keywhen it saves, instead of giving every block a new one, so links to a block from comments and other content survive edits made on the page.The toolbar loads threads with one request per entry on the page, at most four at a time, and only for signed-in users in edit mode who can take part in threads. The popover's code loads the first time someone opens it, from the editor-only
/_emdash/visual-editing/commentspage, which the site's Astro build bundles with@astrojs/react, as it does the inline editor. Pages for logged-out visitors don't change.Permissions
Two permissions are new in
@emdash-cms/auth. Every editorial route also needscontent:read_drafts.editorial:comment(Contributor and above): read threads, start them, and reply.editorial:manage(Editor and above): resolve, reopen and delete any thread, and delete anyone's comment.
A thread's creator may also resolve and reopen it, and so may the entry's author when they hold
content:edit_own. A creator may delete their own thread until someone else replies, and only a comment's author may edit it. Storing recomputed anchors needs edit access to the entry and its current_rev.New playground sessions open with example threads on the "Building for the Long Term" post, from a demo reviewer, so visitors can reply, resolve and add their own.
Upgrading
A migration adds two tables,
_emdash_editorial_threadsand_emdash_editorial_comments. Threads stay while an entry is in the trash, where their comments and threads can still be deleted but not added, edited, resolved or moved, and are deleted with the entry or its collection. Site transfer leaves them out. -
#5104
7ed8e09Thanks @ascorbic! - Fixes setup getting stuck when the first admin is created through GitHub, Google, Microsoft, or AT Protocol sign-in but linking the sign-in account fails partway through. Signing in again with the same account now finishes setup; any other account is still refused.canSelfSignup'screateUserfunction in@emdash-cms/authnow also receives the account being linked, ascreateUser(user, account), and may return an existing user forfindOrCreateOAuthUser()to link that account to. -
#5104
7ed8e09Thanks @ascorbic! - Fixes first-admin creation so only one person becomes admin when several first sign-ins happen at the same moment.- GitHub, Google, Microsoft, and AT Protocol sign-in during setup: the first sign-in becomes admin. A sign-in that finishes at the same time is now refused with
signup_not_allowedinstead of creating a second admin. With AT Protocol, only the account that becomes admin receives the email entered in the setup wizard, so another account can no longer be linked to the admin by that email. - Cloudflare Access: when several people sign in to a new site at once, one becomes admin and the others get the role from their Access groups.
While setup is still open, a sign-in from a new identity is refused once any user exists, matching the passkey setup step.
@emdash-cms/authadds an optionalcreateUser(user)function tocanSelfSignupresults. When present,findOrCreateOAuthUser()calls it instead ofadapter.createUser(). If it returnsnull, the sign-in is refused withsignup_not_allowed.@emdash-cms/auth-atprotonow requiresemdash1.7.0 or later. - GitHub, Google, Microsoft, and AT Protocol sign-in during setup: the first sign-in becomes admin. A sign-in that finishes at the same time is now refused with