Rename delete for everyone to delete from all devices in note to self
This commit is contained in:
parent
3045a4950d
commit
42e13aedcd
3 changed files with 33 additions and 5 deletions
|
@ -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'"
|
||||
|
|
|
@ -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,
|
||||
})}
|
||||
</ConfirmationDialog>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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 (
|
||||
<DeleteMessagesModal
|
||||
isMe={isMe}
|
||||
canDeleteForEveryone={canDeleteForEveryone}
|
||||
i18n={i18n}
|
||||
messageCount={deleteMessagesProps.messageIds.length}
|
||||
|
|
Loading…
Reference in a new issue