Files
overleaf-cep/services/web/frontend/js/shared/utils/mentions.ts
T
Jimmy Domagala-TangandKristina 7e550a9475 Chat and Review-panel mentions (#34564)
* feat: changing chat to use cm6 editor instead to allow for mentions display and autocomplete

* feat: changing review panel comment, edit, and reply to also use cm6 editor to enable mentions

* feat: updating tests, and moving from jsdom to cypress tests as jsdom cant handle cm6

* feat: centralizing mentions component and applying to both chat and review-panel

* feat: centralizing mentions input, and using changesUsers in chat mentions

* fixing dark mode styles of chat

* feat: updating mentions dropdown style and adding custom icon generation for mentions cm6 autocomplete tooltip

* feat: making mentions look like links, and fixing border radius on tooltip

* fix: naming and using correct color util

* feat: fixing hover on highlight

* update scroll bar dance in review panel

when a system had persistent scroll bars, we would run into issues calculating the height of the review panel

Co-authored-by: Kristina <7614497+khjrtbrg@users.noreply.github.com>

---------

Co-authored-by: Kristina <7614497+khjrtbrg@users.noreply.github.com>
GitOrigin-RevId: 96441ad55f9614427506edfecf3d87bae82d1607
2026-09-17 11:29:26 +00:00

40 lines
1.1 KiB
TypeScript

import {
ProjectMember,
ProjectOwner,
} from '@/shared/context/types/project-metadata'
import { debugConsole } from '@/utils/debugging'
import { isSplitTestEnabled } from '@/utils/splitTestUtils'
import { buildName } from '@/shared/utils/build-name'
import { MemberInfo } from '@/features/source-editor/extensions/project-members-info'
export const membersToIdMap = (
members: ProjectMember[],
owner: ProjectOwner | undefined
) => {
const collaboratorIdToName = new Map<string, MemberInfo>()
if (!owner) {
debugConsole.error('no owner found for project')
return collaboratorIdToName
}
collaboratorIdToName.set(owner._id, {
name: buildName(owner),
email: owner.email,
})
for (const member of members) {
collaboratorIdToName.set(member._id, {
name: buildName(member),
email: member.email,
})
}
return collaboratorIdToName
}
// Mention display (parsing @[id] tokens into names) is gated behind both split
// tests, so chat and the review panel render mentions consistently.
export const mentionsFeatureEnabled = () =>
isSplitTestEnabled('email-notifications') &&
isSplitTestEnabled('comment-mentions')