mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-08-28 00:46:33 +01:00
Prefer explicit unmute option when conversation is muted
This commit is contained in:
@@ -667,6 +667,7 @@ function HeaderDropdownMenuContent({
|
||||
onViewConversationDetails: () => void;
|
||||
}) {
|
||||
const muteMenu = getConversationMuteMenu(conversation.muteExpiresAt, i18n);
|
||||
const isMuted = isConversationMuted(conversation);
|
||||
const isGroup = conversation.type === 'group';
|
||||
const disableTimerChanges =
|
||||
!conversation.canChangeTimer ||
|
||||
@@ -701,6 +702,10 @@ function HeaderDropdownMenuContent({
|
||||
[onChangeDisappearingMessages]
|
||||
);
|
||||
|
||||
const onUnmute = useCallback(() => {
|
||||
onChangeMuteExpiration(MuteExpiration.UNMUTED);
|
||||
}, [onChangeMuteExpiration]);
|
||||
|
||||
if (isSelectMode) {
|
||||
return null;
|
||||
}
|
||||
@@ -842,14 +847,20 @@ function HeaderDropdownMenuContent({
|
||||
</AxoDropdownMenu.SubContent>
|
||||
</AxoDropdownMenu.Sub>
|
||||
)}
|
||||
<MuteNotificationsSubMenu
|
||||
i18n={i18n}
|
||||
renderer="AxoDropdownMenu"
|
||||
title={i18n('icu:muteNotificationsTitle')}
|
||||
label={muteMenu.label}
|
||||
options={muteMenu.options}
|
||||
onMuteExpiration={onChangeMuteExpiration}
|
||||
/>
|
||||
{isMuted ? (
|
||||
<AxoDropdownMenu.Item symbol="bell" onSelect={onUnmute}>
|
||||
{i18n('icu:unmute')}
|
||||
</AxoDropdownMenu.Item>
|
||||
) : (
|
||||
<MuteNotificationsSubMenu
|
||||
i18n={i18n}
|
||||
renderer="AxoDropdownMenu"
|
||||
title={i18n('icu:muteNotificationsTitle')}
|
||||
label={muteMenu.label}
|
||||
options={muteMenu.options}
|
||||
onMuteExpiration={onChangeMuteExpiration}
|
||||
/>
|
||||
)}
|
||||
{!isGroup || hasGV2AdminEnabled ? (
|
||||
<AxoDropdownMenu.Item
|
||||
symbol="settings"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
import type { FC, ReactNode, JSX } from 'react';
|
||||
import { memo, useCallback, useMemo, useState } from 'react';
|
||||
import type { MuteExpiration } from '@signalapp/types';
|
||||
import { MuteExpiration } from '@signalapp/types';
|
||||
|
||||
import { AxoContextMenu } from '../../axo/AxoContextMenu.dom.tsx';
|
||||
import type { LocalizerType } from '../../types/I18N.std.ts';
|
||||
@@ -88,6 +88,10 @@ export const LeftPaneConversationListItemContextMenu: FC<LeftPaneConversationLis
|
||||
});
|
||||
}, [muteExpiresAt, i18n, conversation]);
|
||||
|
||||
const isMuted = useMemo(() => {
|
||||
return isConversationMuted(conversation);
|
||||
}, [conversation]);
|
||||
|
||||
const [showConfirmDeleteDialog, setShowConfirmDeleteDialog] =
|
||||
useState(false);
|
||||
|
||||
@@ -126,6 +130,10 @@ export const LeftPaneConversationListItemContextMenu: FC<LeftPaneConversationLis
|
||||
[onUpdateMute, conversationId]
|
||||
);
|
||||
|
||||
const handleUnmute = useCallback(() => {
|
||||
onUpdateMute(conversationId, MuteExpiration.UNMUTED);
|
||||
}, [onUpdateMute, conversationId]);
|
||||
|
||||
const handleArchive = useCallback(() => {
|
||||
onArchive(conversationId);
|
||||
}, [onArchive, conversationId]);
|
||||
@@ -184,14 +192,20 @@ export const LeftPaneConversationListItemContextMenu: FC<LeftPaneConversationLis
|
||||
{i18n('icu:unpinConversation')}
|
||||
</AxoContextMenu.Item>
|
||||
)}
|
||||
<MuteNotificationsSubMenu
|
||||
i18n={i18n}
|
||||
renderer="AxoContextMenu"
|
||||
title={i18n('icu:muteNotificationsTitle')}
|
||||
options={muteMenu.options}
|
||||
label={muteMenu.label}
|
||||
onMuteExpiration={handleUpdateMute}
|
||||
/>
|
||||
{isMuted ? (
|
||||
<AxoContextMenu.Item symbol="bell" onSelect={handleUnmute}>
|
||||
{i18n('icu:unmute')}
|
||||
</AxoContextMenu.Item>
|
||||
) : (
|
||||
<MuteNotificationsSubMenu
|
||||
i18n={i18n}
|
||||
renderer="AxoContextMenu"
|
||||
title={i18n('icu:muteNotificationsTitle')}
|
||||
options={muteMenu.options}
|
||||
label={muteMenu.label}
|
||||
onMuteExpiration={handleUpdateMute}
|
||||
/>
|
||||
)}
|
||||
{!props.isActivelySearching &&
|
||||
isSelectedChatFolderAllChats &&
|
||||
props.currentChatFolders.hasAnyCurrentCustomChatFolders && (
|
||||
|
||||
Reference in New Issue
Block a user