Repository navigation
[SE-641] @ mention users in documents - #26018
Open
ihordubas99 wants to merge 7 commits into
Open
ihordubas99 wants to merge 7 commits into
ihordubas99 wants to merge 7 commits into
Conversation
ihordubas99
marked this pull request as ready for review
October 14, 2026 12:49
ihordubas99
force-pushed
the
feature/se-641-mention-users-extension
branch
2 times, most recently
from
October 16, 2026 09:31
8e3a317 to
5d12057
Compare
1 of 3 tasks
|
Warning Flaky specs
🤖 Ask Copilot to investigateCopy the prompt below into a new comment on this PR to delegate the investigation to GitHub Copilot. It will look into the flakiness and open a separate pull request with you as reviewer. |
ihordubas99
force-pushed
the
feature/se-641-mention-users-extension
branch
from
October 16, 2026 11:01
5d12057 to
9e836eb
Compare
ihordubas99
changed the base branch from
dev
to
feature/se-641-mention-users-in-documents-backend-part-2
October 16, 2026 11:02
ihordubas99
force-pushed
the
feature/se-641-mention-users-extension
branch
from
October 23, 2026 13:32
9e836eb to
9b05cf9
Compare
|
Warning Flaky specs
🤖 Ask Copilot to investigateCopy the prompt below into a new comment on this PR to delegate the investigation to GitHub Copilot. It will look into the flakiness and open a separate pull request with you as reviewer. |
ihordubas99
force-pushed
the
feature/se-641-mention-users-extension
branch
from
October 27, 2026 12:46
9b05cf9 to
c6b8d88
Compare
ihordubas99
force-pushed
the
feature/se-641-mention-users-extension
branch
from
October 27, 2026 13:44
c6b8d88 to
78490d4
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ticket
https://community.openproject.org/wp/SE-641
Moved from opf/op-blocknote-extensions#274, where the earlier review discussion lives. The OpenProject side is a separate PR, #25917. The notification endpoint this calls comes from #26028.
What are you trying to accomplish?
Users can mention people in a document. Typing @ opens a menu with the members of the document's project who are not locked. Picking someone inserts an inline mention with their avatar and name, linking to their profile, and notifies that person.
The mention is stored in the document markdown in exactly the form CKEditor uses, so OpenProject renders it as a user link with a hover card without special cases.
Inside the editor a mention behaves like an inline work package. Clicking it selects it and opens a popover to open the profile or remove the mention. A selected mention can be removed with Backspace and moved with drag and drop.
Screenshots
What approach did you choose and why?
Stored format. BlockNote's markdown export keeps only the text of elements it does not know, so a real
<mention>element would be saved as a plain "@name" and lose its id. Text nodes are copied verbatim, so the server-side spec writes the canonical tag as text. A markdown test pins the exact output in case BlockNote ever starts escaping text. In the browser the clipboard gets a real<mention>element, and a mention copied from a CKEditor field pastes as a mention.Notifications. Hocuspocus saves the changes of everyone editing with the token of the first user who connected, so OpenProject can't tell from a save who added a mention. Instead, the editor calls
POST /api/v3/notificationswhen a mention is inserted, and the author is the user whose session makes the request.initializeOpBlockNoteExtensionstakes thedocumentIdfor this, andUserMentionNotificationExtensionsends one request per mentioned user whenever mentions are picked, pasted or duplicated locally. Moving a mention or its block and changes arriving from collaborators through Yjs don't notify. Cut and paste counts as a new insert.Search. The menu asks
/api/v3/principalsfor users who are not locked and are members of the document's project, matching name, login or email. Like CKEditor, it only opens where a word starts, so typing an email address does not open it.Shared building blocks. A mention needs what the inline work package already had, such as the options popover, node selection, closing on an outside press and a suggestion menu. Instead of copying these, they moved into
lib/components/sharedand a few generic hooks, and the work package code now uses them too. That is why the diff touches many work package files. The first three commits are this refactoring without behaviour changes and can be reviewed on their own.Two small fixes come with the refactoring. Clicking an open inline work package again now closes its popover inside a shadow root instead of reopening it, and a blank # search cancels a pending search again.
Public API. Only additions. The client gets
openProjectUserMentionSpec,OpenProjectMentionMenu,UserMentionNotificationExtension, the trigger constants and the optionaldocumentIdininitializeOpBlockNoteExtensions. The extension has to be passed in the editor'sextensions, because BlockNote doesn't register extensions of inline content specs. The server entry getsopenProjectUserMentionStaticSpecand the stored-format helpers for hocuspocus.Merge checklist