mirror of
https://github.com/danog/telegram-tt.git
synced 2025-01-21 21:01:29 +01:00
Chat: Hide "Archive" action in folders
This commit is contained in:
parent
d5fafe8529
commit
f07d4f1eb7
@ -6,6 +6,7 @@ import { ApiChat, ApiUser } from '../api/types';
|
||||
import {
|
||||
isChatArchived, getCanDeleteChat, isUserId, isChatChannel,
|
||||
} from '../modules/helpers';
|
||||
import { compact } from '../util/iteratees';
|
||||
import useLang from './useLang';
|
||||
|
||||
export default ({
|
||||
@ -27,6 +28,8 @@ export default ({
|
||||
}, isInSearch = false) => {
|
||||
const lang = useLang();
|
||||
|
||||
const { isSelf } = privateChatUser || {};
|
||||
|
||||
return useMemo(() => {
|
||||
if (!chat) {
|
||||
return undefined;
|
||||
@ -88,17 +91,15 @@ export default ({
|
||||
handler: handleDelete,
|
||||
};
|
||||
|
||||
return [
|
||||
const isInFolder = folderId !== undefined;
|
||||
|
||||
return compact([
|
||||
actionAddToFolder,
|
||||
actionUnreadMark,
|
||||
actionPin,
|
||||
...(!privateChatUser?.isSelf ? [
|
||||
actionMute,
|
||||
actionArchive,
|
||||
] : []),
|
||||
!isSelf && actionMute,
|
||||
!isSelf && !isInFolder && actionArchive,
|
||||
actionDelete,
|
||||
];
|
||||
}, [
|
||||
chat, isPinned, lang, isInSearch, isMuted, handleDelete, handleChatFolderChange, privateChatUser?.isSelf, folderId,
|
||||
]);
|
||||
]);
|
||||
}, [chat, lang, handleChatFolderChange, isPinned, isInSearch, isMuted, handleDelete, folderId, isSelf]);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user