Skip to content

Commit

Permalink
Clarify function of "Delete" option when deleting conversation messages
Browse files Browse the repository at this point in the history
  • Loading branch information
trevor-signal committed Oct 31, 2023
1 parent edd6ed5 commit fcf2c0a
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 29 deletions.
18 changes: 15 additions & 3 deletions _locales/en/messages.json
Expand Up @@ -1387,15 +1387,27 @@
},
"icu:deleteMessages": {
"messageformat": "Delete",
"description": "Menu item for deleting messages, title case."
"description": "(deleted 2023/10/26) Menu item for deleting messages, title case."
},
"icu:deleteMessagesInConversation": {
"messageformat": "Delete messages",
"description": "Menu item for deleting all messages in a conversation from your device"
},
"icu:ConversationHeader__DeleteMessagesConfirmation__title": {
"messageformat": "Delete chat?",
"description": "Conversation Header > Delete Action > Delete Messages Confirmation Modal > Title"
"description": "(deleted 2023/10/26) Conversation Header > Delete Action > Delete Messages Confirmation Modal > Title"
},
"icu:ConversationHeader__DeleteMessagesInConversationConfirmation__title": {
"messageformat": "Delete messages?",
"description": "Title for confirmation modal to delete all messages in a conversation"
},
"icu:ConversationHeader__DeleteMessagesConfirmation__description": {
"messageformat": "This chat will be deleted from this device.",
"description": "Conversation Header > Delete Action > Delete Messages Confirmation Modal > Description"
"description": "(deleted 2023/10/26) Conversation Header > Delete Action > Delete Messages Confirmation Modal > Description"
},
"icu:ConversationHeader__DeleteMessagesInConversationConfirmation__description": {
"messageformat": "Messages in this chat will be deleted from this device. You can still search for this chat after you delete messages.",
"description": "Description for confirmation modal to delete all messages in a conversation"
},
"icu:ConversationHeader__ContextMenu__LeaveGroupAction__title": {
"messageformat": "Leave group",
Expand Down
8 changes: 4 additions & 4 deletions ts/components/conversation/ConversationHeader.tsx
Expand Up @@ -424,7 +424,7 @@ export class ConversationHeader extends React.Component<PropsType, StateType> {
this.setState({ hasDeleteMessagesConfirmation: true })
}
>
{i18n('icu:deleteMessages')}
{i18n('icu:deleteMessagesInConversation')}
</MenuItem>
</ContextMenu>
);
Expand Down Expand Up @@ -553,7 +553,7 @@ export class ConversationHeader extends React.Component<PropsType, StateType> {
<MenuItem
onClick={() => this.setState({ hasDeleteMessagesConfirmation: true })}
>
{i18n('icu:deleteMessages')}
{i18n('icu:deleteMessagesInConversation')}
</MenuItem>
{isGroup && (
<MenuItem
Expand Down Expand Up @@ -589,7 +589,7 @@ export class ConversationHeader extends React.Component<PropsType, StateType> {
<ConfirmationDialog
dialogName="ConversationHeader.destroyMessages"
title={i18n(
'icu:ConversationHeader__DeleteMessagesConfirmation__title'
'icu:ConversationHeader__DeleteMessagesInConversationConfirmation__title'
)}
actions={[
{
Expand All @@ -607,7 +607,7 @@ export class ConversationHeader extends React.Component<PropsType, StateType> {
}}
>
{i18n(
'icu:ConversationHeader__DeleteMessagesConfirmation__description'
'icu:ConversationHeader__DeleteMessagesInConversationConfirmation__description'
)}
</ConfirmationDialog>
);
Expand Down
1 change: 0 additions & 1 deletion ts/model-types.d.ts
Expand Up @@ -310,7 +310,6 @@ export type ConversationAttributesType = {
draftBodyRanges?: DraftBodyRanges;
draftTimestamp?: number | null;
hideStory?: boolean;
hiddenFromConversationSearch?: boolean;
inbox_position?: number;
// When contact is removed - it is initially placed into `justNotification`
// removal stage. In this stage user can still send messages (which will
Expand Down
16 changes: 0 additions & 16 deletions ts/models/conversations.ts
Expand Up @@ -371,8 +371,6 @@ export class ConversationModel extends window.Backbone
this.unset('tokens');

this.on('change:members change:membersV2', this.fetchContacts);
this.on('change:isArchived', this.onArchiveChange);

this.typingRefreshTimer = null;
this.typingPauseTimer = null;

Expand Down Expand Up @@ -4141,17 +4139,6 @@ export class ConversationModel extends window.Backbone
}
}

private onArchiveChange() {
const isArchived = this.get('isArchived');
if (isArchived) {
return;
}
if (!this.get('hiddenFromConversationSearch')) {
return;
}
this.set('hiddenFromConversationSearch', false);
}

setMarkedUnread(markedUnread: boolean): void {
const previousMarkedUnread = this.get('markedUnread');

Expand Down Expand Up @@ -4855,9 +4842,6 @@ export class ConversationModel extends window.Backbone
active_at: null,
pendingUniversalTimer: undefined,
});
if (isGroup(this.attributes)) {
this.set('hiddenFromConversationSearch', true);
}
window.Signal.Data.updateConversation(this.attributes);

await window.Signal.Data.removeAllMessagesInConversation(this.id, {
Expand Down
1 change: 0 additions & 1 deletion ts/state/ducks/conversations.ts
Expand Up @@ -250,7 +250,6 @@ export type ConversationType = ReadonlyDeep<
customColorId?: string;
discoveredUnregisteredAt?: number;
hideStory?: boolean;
hiddenFromConversationSearch?: boolean;
isArchived?: boolean;
isBlocked?: boolean;
removalStage?: 'justNotification' | 'messageRequest';
Expand Down
2 changes: 1 addition & 1 deletion ts/util/filterAndSortConversations.ts
Expand Up @@ -106,7 +106,7 @@ function searchConversations(
const phoneNumber = parseAndFormatPhoneNumber(searchTerm, regionCode);

const currentConversations = conversations.filter(conversation => {
return !conversation.left && !conversation.hiddenFromConversationSearch;
return !conversation.left;
});

// Escape the search term
Expand Down
3 changes: 0 additions & 3 deletions ts/util/getConversation.ts
Expand Up @@ -177,9 +177,6 @@ export function getConversation(model: ConversationModel): ConversationType {
groupId: attributes.groupId,
groupLink: buildGroupLink(attributes),
hideStory: Boolean(attributes.hideStory),
hiddenFromConversationSearch: Boolean(
attributes.hiddenFromConversationSearch
),
inboxPosition,
isArchived: attributes.isArchived,
isBlocked: isBlocked(attributes),
Expand Down

0 comments on commit fcf2c0a

Please sign in to comment.