( note: Pick<Note, 'content' | 'resolved'> & Partial<Pick<Note, 'author' | 'authorId'>>, )
| 39 | } |
| 40 | |
| 41 | export function formatNoteBody( |
| 42 | note: Pick<Note, 'content' | 'resolved'> & Partial<Pick<Note, 'author' | 'authorId'>>, |
| 43 | ) { |
| 44 | // Both or neither: a name with no id to compare against buys nothing, and a |
| 45 | // backend whose poster IS the editor records neither. |
| 46 | const identity = |
| 47 | note.authorId && note.author ? { author: note.author, authorId: note.authorId } : {}; |
| 48 | |
| 49 | const marker = encode({ resolved: note.resolved, ...identity }); |
| 50 | |
| 51 | return `${MARKER_PREFIX}${marker}${MARKER_SUFFIX}\n${note.content}`; |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * The marker is hand-editable on the host, so nothing in it is trusted to be |
no test coverage detected