Chat: Hide "Archive" in context menu for Service Notifications (#1712)

This commit is contained in:
Alexander Zinchuk 2022-02-20 13:39:09 +02:00
parent 50c3614fee
commit c4e4846c3d

View File

@ -3,6 +3,7 @@ import { getDispatch } from '../lib/teact/teactn';
import { ApiChat, ApiUser } from '../api/types'; import { ApiChat, ApiUser } from '../api/types';
import { SERVICE_NOTIFICATIONS_USER_ID } from '../config';
import { import {
isChatArchived, getCanDeleteChat, isUserId, isChatChannel, isChatArchived, getCanDeleteChat, isUserId, isChatChannel,
} from '../modules/helpers'; } from '../modules/helpers';
@ -31,6 +32,7 @@ const useChatContextActions = ({
const lang = useLang(); const lang = useLang();
const { isSelf } = user || {}; const { isSelf } = user || {};
const isServiceNotifications = user?.id === SERVICE_NOTIFICATIONS_USER_ID;
return useMemo(() => { return useMemo(() => {
if (!chat) { if (!chat) {
@ -100,11 +102,12 @@ const useChatContextActions = ({
actionUnreadMark, actionUnreadMark,
actionPin, actionPin,
!isSelf && actionMute, !isSelf && actionMute,
!isSelf && !isInFolder && actionArchive, !isSelf && !isServiceNotifications && !isInFolder && actionArchive,
actionDelete, actionDelete,
]); ]);
}, [ }, [
chat, canChangeFolder, lang, handleChatFolderChange, isPinned, isInSearch, isMuted, handleDelete, folderId, isSelf, chat, canChangeFolder, lang, handleChatFolderChange, isPinned, isInSearch, isMuted, handleDelete, folderId, isSelf,
isServiceNotifications,
]); ]);
}; };