From 42e13aedcd640c9825a74de879a6d161a0413acc Mon Sep 17 00:00:00 2001 From: Jamie Kyle <113370520+jamiebuilds-signal@users.noreply.github.com> Date: Thu, 13 Apr 2023 13:38:35 -0700 Subject: [PATCH] Rename delete for everyone to delete from all devices in note to self --- _locales/en/messages.json | 12 ++++++++++++ ts/components/DeleteMessagesModal.tsx | 20 +++++++++++++++----- ts/state/smart/DeleteMessagesModal.tsx | 6 ++++++ 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index f1391af4efa2..47bb5aa96e37 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -8979,6 +8979,10 @@ "messageformat": "Who would you like to delete {count, plural, one {this message} other {these messages}} for?", "description": "delete selected messages > confirmation modal > description" }, + "icu:DeleteMessagesModal--description--noteToSelf": { + "messageformat": "What devices would you like to delete {count, plural, one {this message} other {these messages}} from?", + "description": "within note to self conversation > delete selected messages > confirmation modal > description" + }, "icu:SelectModeActions__confirmDelete--confirm": { "messageformat": "Delete for me", "description": "(deleted 03/24/2023) conversation > in select mode > composition area actions > delete selected messages > confirmation modal > button" @@ -8991,10 +8995,18 @@ "messageformat": "Delete for me", "description": "delete selected messages > confirmation modal > delete for me" }, + "icu:DeleteMessagesModal--deleteFromThisDevice": { + "messageformat": "Delete from this device", + "description": "within note to self conversation > delete selected messages > confirmation modal > delete from this device (same as delete for me)" + }, "icu:DeleteMessagesModal--deleteForEveryone": { "messageformat": "Delete for everyone", "description": "delete selected messages > confirmation modal > delete for everyone" }, + "icu:DeleteMessagesModal--deleteFromAllDevices": { + "messageformat": "Delete from all devices", + "description": "within note to self conversation > delete selected messages > confirmation modal > delete from all devices (same as delete for everyone)" + }, "icu:DeleteMessagesModal__toast--TooManyMessagesToDeleteForEveryone": { "messageformat": "You can only select up to {count, plural, one {# message} other {# messages}} to delete for everyone", "description": "delete selected messages > confirmation modal > deleted for everyone (disabled) > toast > too many messages to 'delete for everyone'" diff --git a/ts/components/DeleteMessagesModal.tsx b/ts/components/DeleteMessagesModal.tsx index e10b891ca55d..e12c248270ae 100644 --- a/ts/components/DeleteMessagesModal.tsx +++ b/ts/components/DeleteMessagesModal.tsx @@ -9,6 +9,7 @@ import type { ShowToastAction } from '../state/ducks/toast'; import { ToastType } from '../types/Toast'; type DeleteMessagesModalProps = Readonly<{ + isMe: boolean; canDeleteForEveryone: boolean; i18n: LocalizerType; messageCount: number; @@ -21,6 +22,7 @@ type DeleteMessagesModalProps = Readonly<{ const MAX_DELETE_FOR_EVERYONE = 30; export default function DeleteMessagesModal({ + isMe, canDeleteForEveryone, i18n, messageCount, @@ -34,7 +36,9 @@ export default function DeleteMessagesModal({ actions.push({ action: onDeleteForMe, style: 'negative', - text: i18n('icu:DeleteMessagesModal--deleteForMe'), + text: isMe + ? i18n('icu:DeleteMessagesModal--deleteFromThisDevice') + : i18n('icu:DeleteMessagesModal--deleteForMe'), }); if (canDeleteForEveryone) { @@ -53,7 +57,9 @@ export default function DeleteMessagesModal({ } }, style: 'negative', - text: i18n('icu:DeleteMessagesModal--deleteForEveryone'), + text: isMe + ? i18n('icu:DeleteMessagesModal--deleteFromAllDevices') + : i18n('icu:DeleteMessagesModal--deleteForEveryone'), }); } @@ -68,9 +74,13 @@ export default function DeleteMessagesModal({ })} moduleClassName="DeleteMessagesModal" > - {i18n('icu:DeleteMessagesModal--description', { - count: messageCount, - })} + {isMe + ? i18n('icu:DeleteMessagesModal--description--noteToSelf', { + count: messageCount, + }) + : i18n('icu:DeleteMessagesModal--description', { + count: messageCount, + })} ); } diff --git a/ts/state/smart/DeleteMessagesModal.tsx b/ts/state/smart/DeleteMessagesModal.tsx index 041c6bddf697..162ce795379c 100644 --- a/ts/state/smart/DeleteMessagesModal.tsx +++ b/ts/state/smart/DeleteMessagesModal.tsx @@ -12,6 +12,7 @@ import { strictAssert } from '../../util/assert'; import { canDeleteMessagesForEveryone } from '../selectors/message'; import { useConversationsActions } from '../ducks/conversations'; import { useToastActions } from '../ducks/toast'; +import { getConversationSelector } from '../selectors/conversations'; export function SmartDeleteMessagesModal(): JSX.Element | null { const deleteMessagesProps = useSelector< @@ -23,6 +24,10 @@ export function SmartDeleteMessagesModal(): JSX.Element | null { 'Cannot render delete messages modal without messages' ); const { conversationId, messageIds, onDelete } = deleteMessagesProps; + const isMe = useSelector((state: StateType) => { + return getConversationSelector(state)(conversationId).isMe; + }); + const canDeleteForEveryone = useSelector((state: StateType) => { return canDeleteMessagesForEveryone(state, messageIds); }); @@ -37,6 +42,7 @@ export function SmartDeleteMessagesModal(): JSX.Element | null { return (