mirror of
https://github.com/danog/telegram-tt.git
synced 2025-01-22 05:11:55 +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 {
|
import {
|
||||||
isChatArchived, getCanDeleteChat, isUserId, isChatChannel,
|
isChatArchived, getCanDeleteChat, isUserId, isChatChannel,
|
||||||
} from '../modules/helpers';
|
} from '../modules/helpers';
|
||||||
|
import { compact } from '../util/iteratees';
|
||||||
import useLang from './useLang';
|
import useLang from './useLang';
|
||||||
|
|
||||||
export default ({
|
export default ({
|
||||||
@ -27,6 +28,8 @@ export default ({
|
|||||||
}, isInSearch = false) => {
|
}, isInSearch = false) => {
|
||||||
const lang = useLang();
|
const lang = useLang();
|
||||||
|
|
||||||
|
const { isSelf } = privateChatUser || {};
|
||||||
|
|
||||||
return useMemo(() => {
|
return useMemo(() => {
|
||||||
if (!chat) {
|
if (!chat) {
|
||||||
return undefined;
|
return undefined;
|
||||||
@ -88,17 +91,15 @@ export default ({
|
|||||||
handler: handleDelete,
|
handler: handleDelete,
|
||||||
};
|
};
|
||||||
|
|
||||||
return [
|
const isInFolder = folderId !== undefined;
|
||||||
|
|
||||||
|
return compact([
|
||||||
actionAddToFolder,
|
actionAddToFolder,
|
||||||
actionUnreadMark,
|
actionUnreadMark,
|
||||||
actionPin,
|
actionPin,
|
||||||
...(!privateChatUser?.isSelf ? [
|
!isSelf && actionMute,
|
||||||
actionMute,
|
!isSelf && !isInFolder && actionArchive,
|
||||||
actionArchive,
|
|
||||||
] : []),
|
|
||||||
actionDelete,
|
actionDelete,
|
||||||
];
|
]);
|
||||||
}, [
|
}, [chat, lang, handleChatFolderChange, isPinned, isInSearch, isMuted, handleDelete, folderId, isSelf]);
|
||||||
chat, isPinned, lang, isInSearch, isMuted, handleDelete, handleChatFolderChange, privateChatUser?.isSelf, folderId,
|
|
||||||
]);
|
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user