Middle Header: Remove Block item for Saved Messages (#4000)

This commit is contained in:
Alexander Zinchuk 2023-12-04 14:38:24 +01:00
parent 82af54555c
commit 63f67ef810

View File

@ -27,6 +27,7 @@ import {
selectChat, selectChat,
selectChatFullInfo, selectChatFullInfo,
selectCurrentMessageList, selectCurrentMessageList,
selectIsChatWithSelf,
selectIsPremiumPurchaseBlocked, selectIsPremiumPurchaseBlocked,
selectIsRightColumnShown, selectNotifyExceptions, selectIsRightColumnShown, selectNotifyExceptions,
selectNotifySettings, selectNotifySettings,
@ -116,6 +117,7 @@ type StateProps = {
canTranslate?: boolean; canTranslate?: boolean;
isBlocked?: boolean; isBlocked?: boolean;
isBot?: boolean; isBot?: boolean;
isChatWithSelf?: boolean;
}; };
const CLOSE_MENU_ANIMATION_DURATION = 200; const CLOSE_MENU_ANIMATION_DURATION = 200;
@ -158,6 +160,7 @@ const HeaderMenuContainer: FC<OwnProps & StateProps> = ({
canTranslate, canTranslate,
isBlocked, isBlocked,
isBot, isBot,
isChatWithSelf,
onJoinRequestsClick, onJoinRequestsClick,
onSubscribeChannel, onSubscribeChannel,
onSearchClick, onSearchClick,
@ -604,7 +607,7 @@ const HeaderMenuContainer: FC<OwnProps & StateProps> = ({
{isBlocked ? lang('BotRestart') : lang('Bot.Stop')} {isBlocked ? lang('BotRestart') : lang('Bot.Stop')}
</MenuItem> </MenuItem>
)} )}
{isPrivate && !isBot && ( {isPrivate && !isChatWithSelf && !isBot && (
<MenuItem <MenuItem
icon={isBlocked ? 'user' : 'hand-stop'} icon={isBlocked ? 'user' : 'hand-stop'}
onClick={isBlocked ? handleUnblock : handleBlock} onClick={isBlocked ? handleUnblock : handleBlock}
@ -665,6 +668,7 @@ export default memo(withGlobal<OwnProps>(
const user = isPrivate ? selectUser(global, chatId) : undefined; const user = isPrivate ? selectUser(global, chatId) : undefined;
const canAddContact = user && getCanAddContact(user); const canAddContact = user && getCanAddContact(user);
const isMainThread = threadId === MAIN_THREAD_ID; const isMainThread = threadId === MAIN_THREAD_ID;
const isChatWithSelf = selectIsChatWithSelf(global, chatId);
const canReportChat = isMainThread && (isChatChannel(chat) || isChatGroup(chat) || (user && !user.isSelf)); const canReportChat = isMainThread && (isChatChannel(chat) || isChatGroup(chat) || (user && !user.isSelf));
const { chatId: currentChatId, threadId: currentThreadId } = selectCurrentMessageList(global) || {}; const { chatId: currentChatId, threadId: currentThreadId } = selectCurrentMessageList(global) || {};
@ -707,6 +711,7 @@ export default memo(withGlobal<OwnProps>(
canTranslate, canTranslate,
isBlocked: userFullInfo?.isBlocked, isBlocked: userFullInfo?.isBlocked,
isBot: Boolean(chatBot), isBot: Boolean(chatBot),
isChatWithSelf,
}; };
}, },
)(HeaderMenuContainer)); )(HeaderMenuContainer));