Skip to content

Commit c2698a3

Browse files
committed
fixup! ♻️(frontend) add user avatar to thread comments
1 parent 2dedaa0 commit c2698a3

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/frontend/apps/impress/src/features/docs/doc-editor/components/BlockNoteEditor.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,15 @@ export const BlockNoteEditor = ({ doc, provider }: BlockNoteEditorProps) => {
9797

9898
const { uploadFile, errorAttachment } = useUploadFile(doc.id);
9999

100-
const collabName = readOnly
101-
? 'Reader'
102-
: user?.full_name || user?.email || t('Anonymous');
100+
const collabName = user?.full_name || user?.email;
101+
const cursorName = readOnly ? 'Reader' : collabName || t('Anonymous');
103102
const showCursorLabels: 'always' | 'activity' | (string & {}) = 'activity';
104103

105104
const threadStore = useComments(doc, user);
106105

107-
const currentUserAvatarUrl =
108-
canSeeComment && collabName !== 'Reader'
109-
? avatarUrlFromName(collabName, themeTokens?.font?.families?.base)
110-
: undefined;
106+
const currentUserAvatarUrl = canSeeComment
107+
? avatarUrlFromName(collabName, themeTokens?.font?.families?.base)
108+
: undefined;
111109

112110
const editor: DocsBlockNoteEditor = useCreateBlockNote(
113111
{
@@ -116,7 +114,7 @@ export const BlockNoteEditor = ({ doc, provider }: BlockNoteEditorProps) => {
116114
provider,
117115
fragment: provider.document.getXmlFragment('document-store'),
118116
user: {
119-
name: collabName,
117+
name: cursorName,
120118
color: randomColor(),
121119
},
122120
/**
@@ -192,7 +190,7 @@ export const BlockNoteEditor = ({ doc, provider }: BlockNoteEditorProps) => {
192190
uploadFile,
193191
schema: blockNoteSchema,
194192
},
195-
[collabName, lang, provider, uploadFile, threadStore],
193+
[cursorName, lang, provider, uploadFile, threadStore],
196194
);
197195

198196
useHeadings(editor);

0 commit comments

Comments
 (0)