feat(core): support mentions in comments (#13000)

fix AF-2706, PD-2687

<img width="412" alt="image"
src="https://github.com/user-attachments/assets/b796f543-1c42-452a-8f65-9dddfa751ab4"
/>
<img width="384" alt="image"
src="https://github.com/user-attachments/assets/7ac3bcc5-6cf1-49bb-9786-1eb33fad7225"
/>
<img width="347" alt="image"
src="https://github.com/user-attachments/assets/02babd37-4740-4770-8be8-e253be18bb5a"
/>

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

## Summary by CodeRabbit

* **New Features**
* Added support for mentions in comments and replies, including
detection and notification when users are mentioned.
* Introduced new notification types for comments and comment mentions,
with dedicated notification components and localized messages.
  * Enabled navigation directly to specific comments from notifications.
* Sidebar comment tab and comment features now depend on both feature
flags and server support.

* **Improvements**
  * Comment creation and reply workflows now support optional mentions.
* Menu configurations for linked widgets can now selectively include
specific menu groups.
* Enhanced navigation helper with a function to jump directly to a page
comment.
  * Improved comment entity lifecycle management for proper cleanup.

* **Bug Fixes**
* Improved lifecycle management for comment entities to ensure proper
cleanup.

* **Style**
* Updated mention styling to use a dynamic font size based on theme
variables.
  * Adjusted comment preview container underline highlight color.

* **Localization**
* Added English translations for comment and mention notification
messages.

* **Configuration**
* Updated feature flag logic for comment features, making configuration
more flexible and environment-aware.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->





#### PR Dependency Tree


* **PR #13000** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)
This commit is contained in:
Peng Xiao
2025-07-03 14:44:14 +08:00
committed by GitHub
parent a7aa761e43
commit 532ea6af07
15 changed files with 317 additions and 26 deletions
+20
View File
@@ -9438,6 +9438,26 @@ export const TypedTrans: {
["1"]: JSX.Element;
["2"]: JSX.Element;
}>>;
/**
* `<1>{{username}}</1> commented in <2>{{docTitle}}</2>`
*/
["com.affine.notification.comment"]: ComponentType<TypedTransProps<Readonly<{
username: string;
docTitle: string;
}>, {
["1"]: JSX.Element;
["2"]: JSX.Element;
}>>;
/**
* `<1>{{username}}</1> mentioned you in a comment in <2>{{docTitle}}</2>`
*/
["com.affine.notification.comment-mention"]: ComponentType<TypedTransProps<Readonly<{
username: string;
docTitle: string;
}>, {
["1"]: JSX.Element;
["2"]: JSX.Element;
}>>;
/**
* `<1>{{username}}</1> has accept your invitation`
*/
@@ -1932,6 +1932,8 @@
"com.affine.page-starter-bar.edgeless": "Edgeless",
"com.affine.notification.unsupported": "Unsupported message",
"com.affine.notification.mention": "<1>{{username}}</1> mentioned you in <2>{{docTitle}}</2>",
"com.affine.notification.comment": "<1>{{username}}</1> commented in <2>{{docTitle}}</2>",
"com.affine.notification.comment-mention": "<1>{{username}}</1> mentioned you in a comment in <2>{{docTitle}}</2>",
"com.affine.notification.empty": "No new notifications",
"com.affine.notification.loading-more": "Loading more...",
"com.affine.notification.empty.description": "You'll be notified here for @mentions and workspace invites.",