Fixes notification text for story reactions

This commit is contained in:
Josh Perez 2023-02-01 18:38:33 -05:00 committed by GitHub
parent 7baffecc96
commit ba848eec84
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 12 deletions

View file

@ -895,7 +895,14 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
}); });
} }
if (attributes.type === 'incoming') { const ourUuid = window.textsecure.storage.user
.getCheckedUuid()
.toString();
if (
attributes.type === 'incoming' &&
attributes.storyReaction.targetAuthorUuid === ourUuid
) {
return window.i18n('Quote__story-reaction-notification--incoming', { return window.i18n('Quote__story-reaction-notification--incoming', {
emoji: attributes.storyReaction.emoji, emoji: attributes.storyReaction.emoji,
}); });
@ -3362,6 +3369,18 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
`${getMessageIdForLogging(storyMessage)} from this device` `${getMessageIdForLogging(storyMessage)} from this device`
); );
} else { } else {
if (isFromSomeoneElse) {
log.info(
'handleReaction: receiving story reaction to ' +
`${getMessageIdForLogging(storyMessage)} from someone else`
);
} else if (isFromSync) {
log.info(
'handleReaction: receiving story reaction to ' +
`${getMessageIdForLogging(storyMessage)} from another device`
);
}
const generatedMessage = reaction.get('storyReactionMessage'); const generatedMessage = reaction.get('storyReactionMessage');
strictAssert( strictAssert(
generatedMessage, generatedMessage,
@ -3420,21 +3439,15 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
); );
} }
} }
if (isFromSomeoneElse) {
drop(targetConversation.notify(messageToAdd));
}
if (isFromSync) { if (isFromSomeoneElse) {
log.info( log.info(
'handleReaction: receiving story reaction to ' + 'handleReaction: notifying for story reaction to ' +
`${getMessageIdForLogging(storyMessage)} from another device`
);
} else {
log.info(
'handleReaction: receiving story reaction to ' +
`${getMessageIdForLogging(storyMessage)} from someone else` `${getMessageIdForLogging(storyMessage)} from someone else`
); );
void conversation.notify(this, reaction); if (await shouldReplyNotifyUser(messageToAdd, targetConversation)) {
drop(targetConversation.notify(messageToAdd));
}
} }
} }
} else { } else {

View file

@ -307,6 +307,8 @@ class NotificationService extends EventEmitter {
} else { } else {
notificationMessage = i18n('newMessage'); notificationMessage = i18n('newMessage');
} }
} else if (storyId) {
notificationMessage = message;
} else if (reaction) { } else if (reaction) {
notificationMessage = i18n('notificationReactionMessage', { notificationMessage = i18n('notificationReactionMessage', {
sender: senderTitle, sender: senderTitle,