mirror of
https://github.com/danog/telegram-tt.git
synced 2024-12-13 01:27:37 +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,
|
isPinned,
|
||||||
isMuted,
|
isMuted,
|
||||||
handleDelete: openDeleteModal,
|
handleDelete: openDeleteModal,
|
||||||
});
|
}, true);
|
||||||
|
|
||||||
const handleClick = () => {
|
const handleClick = () => {
|
||||||
onClick(chatId);
|
onClick(chatId);
|
||||||
|
@ -22,26 +22,20 @@ export default ({
|
|||||||
folderId?: number;
|
folderId?: number;
|
||||||
isPinned?: boolean;
|
isPinned?: boolean;
|
||||||
isMuted?: boolean;
|
isMuted?: boolean;
|
||||||
}) => {
|
}, isInSearch = false) => {
|
||||||
const lang = useLang();
|
const lang = useLang();
|
||||||
|
|
||||||
const {
|
|
||||||
toggleChatPinned,
|
|
||||||
updateChatMutedState,
|
|
||||||
toggleChatArchived,
|
|
||||||
toggleChatUnread,
|
|
||||||
} = getDispatch();
|
|
||||||
|
|
||||||
return useMemo(() => {
|
return useMemo(() => {
|
||||||
if (!chat) {
|
if (!chat) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
const isChatWithSelf = privateChatUser?.isSelf;
|
const {
|
||||||
|
toggleChatPinned,
|
||||||
const actionUnreadMark = chat.unreadCount || chat.hasUnreadMark
|
updateChatMutedState,
|
||||||
? { title: lang('MarkAsRead'), icon: 'readchats', handler: () => toggleChatUnread({ id: chat.id }) }
|
toggleChatArchived,
|
||||||
: { title: lang('MarkAsUnread'), icon: 'unread', handler: () => toggleChatUnread({ id: chat.id }) };
|
toggleChatUnread,
|
||||||
|
} = getDispatch();
|
||||||
|
|
||||||
const actionPin = isPinned
|
const actionPin = isPinned
|
||||||
? {
|
? {
|
||||||
@ -51,6 +45,14 @@ export default ({
|
|||||||
}
|
}
|
||||||
: { title: lang('PinToTop'), icon: 'pin', handler: () => toggleChatPinned({ id: chat.id, folderId }) };
|
: { 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
|
const actionMute = isMuted
|
||||||
? {
|
? {
|
||||||
title: lang('ChatList.Unmute'),
|
title: lang('ChatList.Unmute'),
|
||||||
@ -81,14 +83,11 @@ export default ({
|
|||||||
return [
|
return [
|
||||||
actionUnreadMark,
|
actionUnreadMark,
|
||||||
actionPin,
|
actionPin,
|
||||||
...(!isChatWithSelf ? [
|
...(!privateChatUser?.isSelf ? [
|
||||||
actionMute,
|
actionMute,
|
||||||
actionArchive,
|
actionArchive,
|
||||||
] : []),
|
] : []),
|
||||||
actionDelete,
|
actionDelete,
|
||||||
];
|
];
|
||||||
}, [
|
}, [chat, isPinned, lang, isInSearch, isMuted, handleDelete, privateChatUser?.isSelf, folderId]);
|
||||||
chat, privateChatUser, lang, isPinned, handleDelete, toggleChatUnread, toggleChatPinned, folderId,
|
|
||||||
updateChatMutedState, toggleChatArchived, isMuted,
|
|
||||||
]);
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user