mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-04 02:49:57 +08:00
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:
@@ -17,6 +17,7 @@ import { PageDetailEditor } from '@affine/core/components/page-detail-editor';
|
||||
import { WorkspacePropertySidebar } from '@affine/core/components/properties/sidebar';
|
||||
import { TrashPageFooter } from '@affine/core/components/pure/trash-page-footer';
|
||||
import { TopTip } from '@affine/core/components/top-tip';
|
||||
import { ServerService } from '@affine/core/modules/cloud';
|
||||
import { DocService } from '@affine/core/modules/doc';
|
||||
import { EditorService } from '@affine/core/modules/editor';
|
||||
import { FeatureFlagService } from '@affine/core/modules/feature-flag';
|
||||
@@ -33,6 +34,7 @@ import {
|
||||
} from '@affine/core/modules/workbench';
|
||||
import { WorkspaceService } from '@affine/core/modules/workspace';
|
||||
import { isNewTabTrigger } from '@affine/core/utils';
|
||||
import { ServerFeature } from '@affine/graphql';
|
||||
import track from '@affine/track';
|
||||
import { DisposableGroup } from '@blocksuite/affine/global/disposable';
|
||||
import { RefNodeSlotsProvider } from '@blocksuite/affine/inlines/reference';
|
||||
@@ -113,6 +115,14 @@ const DetailPageImpl = memo(function DetailPageImpl() {
|
||||
featureFlagService.flags.enable_adapter_panel.$
|
||||
);
|
||||
|
||||
const serverService = useService(ServerService);
|
||||
const serverConfig = useLiveData(serverService.server.config$);
|
||||
|
||||
const enableComment =
|
||||
useLiveData(featureFlagService.flags.enable_comment.$) &&
|
||||
// comment may not be supported by the server
|
||||
serverConfig.features.includes(ServerFeature.Comment);
|
||||
|
||||
useEffect(() => {
|
||||
if (isActiveView) {
|
||||
setActiveBlockSuiteEditor(editorContainer);
|
||||
@@ -383,7 +393,7 @@ const DetailPageImpl = memo(function DetailPageImpl() {
|
||||
</ViewSidebarTab>
|
||||
)}
|
||||
|
||||
{workspace.flavour !== 'local' && (
|
||||
{workspace.flavour !== 'local' && enableComment && (
|
||||
<ViewSidebarTab tabId="comment" icon={<CommentIcon />}>
|
||||
<Scrollable.Root className={styles.sidebarScrollArea}>
|
||||
<Scrollable.Viewport>
|
||||
|
||||
Reference in New Issue
Block a user