Add pinned message notifications

This commit is contained in:
Jamie
2025-12-16 07:47:46 -08:00
committed by GitHub
parent 5ec3f763cd
commit 0a12e1ec17
6 changed files with 59 additions and 18 deletions

View File

@@ -512,7 +512,21 @@ export function getNotificationDataForMessage(
}
if (isPinnedMessageNotification(attributes)) {
throw new Error('unimplemented');
const fromContact = getAuthor(attributes);
const ourAci = itemStorage.user.getCheckedAci();
let text: string;
if (fromContact?.getAci() === ourAci) {
text = i18n('icu:message--pinned--preview--sent');
} else {
const sender = fromContact?.getTitle() ?? i18n('icu:unknownContact');
text = i18n('icu:message--pinned--preview--received', { sender });
}
return {
emoji: '📌',
text,
};
}
const { poll } = attributes;