From 13785a09365f6fd5f46ed1117269b679d7d44913 Mon Sep 17 00:00:00 2001 From: Josh Perez <60019601+josh-signal@users.noreply.github.com> Date: Wed, 26 Oct 2022 18:36:11 -0400 Subject: [PATCH] Update reaction last message notification text --- _locales/en/messages.json | 12 ++++++++++++ ts/models/messages.ts | 24 ++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index c4963f2790..476c2ba6db 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -5943,6 +5943,18 @@ "message": "Reacted to a story", "description": "Used whenever we can't find a user's first name" }, + "Quote__story-reaction-notification--incoming": { + "message": "Reacted $emoji$ to your story", + "description": "Notification test for incoming story reactions" + }, + "Quote__story-reaction-notification--outgoing": { + "message": "You reacted $emoji$ to a story from $name$", + "description": "Notification test for outgoing story reactions" + }, + "Quote__story-reaction-notification--outgoing--nameless": { + "message": "You reacted $emoji$ to a story", + "description": "Notification test for outgoing story reactions but no name" + }, "Quote__story-unavailable": { "message": "No longer available", "description": "Label for when a story is not found" diff --git a/ts/models/messages.ts b/ts/models/messages.ts index 71e251dbad..f5c7f2a6c5 100644 --- a/ts/models/messages.ts +++ b/ts/models/messages.ts @@ -956,6 +956,30 @@ export class MessageModel extends window.Backbone.Model { const { attributes } = this; if (attributes.storyReactionEmoji) { + if (attributes.type === 'outgoing') { + const name = this.getConversation()?.get('profileName'); + + if (!name) { + return window.i18n( + 'Quote__story-reaction-notification--outgoing--nameless', + { + emoji: attributes.storyReactionEmoji, + } + ); + } + + return window.i18n('Quote__story-reaction-notification--outgoing', { + emoji: attributes.storyReactionEmoji, + name, + }); + } + + if (attributes.type === 'incoming') { + return window.i18n('Quote__story-reaction-notification--incoming', { + emoji: attributes.storyReactionEmoji, + }); + } + if (!window.Signal.OS.isLinux()) { return attributes.storyReactionEmoji; }