mirror of
https://github.com/danog/telegram-tt.git
synced 2024-12-13 17:47:39 +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,9 +22,14 @@ export default ({
|
||||
folderId?: number;
|
||||
isPinned?: boolean;
|
||||
isMuted?: boolean;
|
||||
}) => {
|
||||
}, isInSearch = false) => {
|
||||
const lang = useLang();
|
||||
|
||||
return useMemo(() => {
|
||||
if (!chat) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const {
|
||||
toggleChatPinned,
|
||||
updateChatMutedState,
|
||||
@ -32,17 +37,6 @@ export default ({
|
||||
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 actionPin = isPinned
|
||||
? {
|
||||
title: lang('UnpinFromTop'),
|
||||
@ -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