Add message preview for polls

This commit is contained in:
yash-signal
2025-10-27 17:52:56 -05:00
committed by GitHub
parent 39081785d4
commit 4fc8560103
2 changed files with 15 additions and 0 deletions

View File

@@ -3068,6 +3068,10 @@
"messageformat": "Sticker message",
"description": "Shown in notifications and in the left pane instead of sticker image."
},
"icu:message--getNotificationText--poll": {
"messageformat": "Poll: {pollQuestion}",
"description": "Shown in notifications and in the left pane when a poll message is received. {pollQuestion} is the poll question text."
},
"icu:message--getNotificationText--text-with-emoji": {
"messageformat": "{emoji} {text}",
"description": "Shown in notifications and in the left pane when text has an emoji. Probably always [emoji] [text] on LTR languages and [text] [emoji] on RTL languages."

View File

@@ -510,6 +510,17 @@ export function getNotificationDataForMessage(
};
}
const { poll } = attributes;
if (poll) {
return {
emoji: '📊',
text: i18n('icu:message--getNotificationText--poll', {
pollQuestion: poll.question,
}),
bodyRanges,
};
}
if (body) {
return {
text: body,