import { Node } from 'prosemirror-model'; /** * The distinct user ids mentioned in a document (issue #150) — the input for * the derived `page_mentions` rows and the mention notifications (#151). * Mentions without a resolved user id (e.g. from a Markdown import) are * purely visual and excluded. */ export function extractMentionUserIds(doc: Node): string[] { const ids = new Set(); doc.descendants((node) => { if (node.type.name === 'mention') { const userId = node.attrs.userId as string; if (userId) ids.add(userId); } }); return [...ids]; }