From c4e4846c3d52c379debfe2607b7ed50fbd8333af Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Sun, 20 Feb 2022 13:39:09 +0200 Subject: [PATCH] Chat: Hide "Archive" in context menu for Service Notifications (#1712) --- src/hooks/useChatContextActions.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/hooks/useChatContextActions.ts b/src/hooks/useChatContextActions.ts index fc247a038..f91359ffc 100644 --- a/src/hooks/useChatContextActions.ts +++ b/src/hooks/useChatContextActions.ts @@ -3,6 +3,7 @@ import { getDispatch } from '../lib/teact/teactn'; import { ApiChat, ApiUser } from '../api/types'; +import { SERVICE_NOTIFICATIONS_USER_ID } from '../config'; import { isChatArchived, getCanDeleteChat, isUserId, isChatChannel, } from '../modules/helpers'; @@ -31,6 +32,7 @@ const useChatContextActions = ({ const lang = useLang(); const { isSelf } = user || {}; + const isServiceNotifications = user?.id === SERVICE_NOTIFICATIONS_USER_ID; return useMemo(() => { if (!chat) { @@ -100,11 +102,12 @@ const useChatContextActions = ({ actionUnreadMark, actionPin, !isSelf && actionMute, - !isSelf && !isInFolder && actionArchive, + !isSelf && !isServiceNotifications && !isInFolder && actionArchive, actionDelete, ]); }, [ chat, canChangeFolder, lang, handleChatFolderChange, isPinned, isInSearch, isMuted, handleDelete, folderId, isSelf, + isServiceNotifications, ]); };