mirror of
https://github.com/danog/telegram-tt.git
synced 2024-12-13 09:37:29 +01:00
Left Search: Do not show unneeded context menu items
This commit is contained in:
parent
d76c948b06
commit
44adc496b6
@ -48,7 +48,7 @@ const LeftSearchResultChat: FC<OwnProps & StateProps> = ({
|
||||
isPinned,
|
||||
isMuted,
|
||||
handleDelete: openDeleteModal,
|
||||
});
|
||||
}, true);
|
||||
|
||||
const handleClick = () => {
|
||||
onClick(chatId);
|
||||
|
@ -22,26 +22,20 @@ export default ({
|
||||
folderId?: number;
|
||||
isPinned?: boolean;
|
||||
isMuted?: boolean;
|
||||
}) => {
|
||||
}, isInSearch = false) => {
|
||||
const lang = useLang();
|
||||
|
||||
const {
|
||||
toggleChatPinned,
|
||||
updateChatMutedState,
|
||||
toggleChatArchived,
|
||||
toggleChatUnread,
|
||||
} = getDispatch();
|
||||
|
||||
return useMemo(() => {
|
||||
if (!chat) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const isChatWithSelf = privateChatUser?.isSelf;
|
||||
|
||||
const actionUnreadMark = chat.unreadCount || chat.hasUnreadMark
|
||||
? { title: lang('MarkAsRead'), icon: 'readchats', handler: () => toggleChatUnread({ id: chat.id }) }
|
||||
: { title: lang('MarkAsUnread'), icon: 'unread', handler: () => toggleChatUnread({ id: chat.id }) };
|
||||
const {
|
||||
toggleChatPinned,
|
||||
updateChatMutedState,
|
||||
toggleChatArchived,
|
||||
toggleChatUnread,
|
||||
} = getDispatch();
|
||||
|
||||
const actionPin = isPinned
|
||||
? {
|
||||
@ -51,6 +45,14 @@ export default ({
|
||||
}
|
||||
: { title: lang('PinToTop'), icon: 'pin', handler: () => toggleChatPinned({ id: chat.id, folderId }) };
|
||||
|
||||
if (isInSearch) {
|
||||
return [actionPin];
|
||||
}
|
||||
|
||||
const actionUnreadMark = chat.unreadCount || chat.hasUnreadMark
|
||||
? { title: lang('MarkAsRead'), icon: 'readchats', handler: () => toggleChatUnread({ id: chat.id }) }
|
||||
: { title: lang('MarkAsUnread'), icon: 'unread', handler: () => toggleChatUnread({ id: chat.id }) };
|
||||
|
||||
const actionMute = isMuted
|
||||
? {
|
||||
title: lang('ChatList.Unmute'),
|
||||
@ -81,14 +83,11 @@ export default ({
|
||||
return [
|
||||
actionUnreadMark,
|
||||
actionPin,
|
||||
...(!isChatWithSelf ? [
|
||||
...(!privateChatUser?.isSelf ? [
|
||||
actionMute,
|
||||
actionArchive,
|
||||
] : []),
|
||||
actionDelete,
|
||||
];
|
||||
}, [
|
||||
chat, privateChatUser, lang, isPinned, handleDelete, toggleChatUnread, toggleChatPinned, folderId,
|
||||
updateChatMutedState, toggleChatArchived, isMuted,
|
||||
]);
|
||||
}, [chat, isPinned, lang, isInSearch, isMuted, handleDelete, privateChatUser?.isSelf, folderId]);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user