Global Search: Allow adding to folders from chat results

This commit is contained in:
Alexander Zinchuk 2022-02-02 22:48:40 +01:00
parent 1aaf5132c3
commit 9415e0da19
2 changed files with 10 additions and 6 deletions

View File

@ -30,16 +30,18 @@ type StateProps = {
user?: ApiUser;
isPinned?: boolean;
isMuted?: boolean;
canChangeFolder?: boolean;
};
const LeftSearchResultChat: FC<OwnProps & StateProps> = ({
chatId,
withUsername,
onClick,
chat,
user,
isPinned,
isMuted,
withUsername,
onClick,
canChangeFolder,
}) => {
const [isDeleteModalOpen, openDeleteModal, closeDeleteModal] = useFlag();
const [isChatFolderModalOpen, openChatFolderModal, closeChatFolderModal] = useFlag();
@ -49,6 +51,7 @@ const LeftSearchResultChat: FC<OwnProps & StateProps> = ({
user,
isPinned,
isMuted,
canChangeFolder,
handleDelete: openDeleteModal,
handleChatFolderChange: openChatFolderModal,
}, true);
@ -104,6 +107,7 @@ export default memo(withGlobal<OwnProps>(
user,
isPinned,
isMuted,
canChangeFolder: Boolean(global.chatFolders.orderedIds?.length),
};
},
)(LeftSearchResultChat));

View File

@ -12,21 +12,21 @@ import useLang from './useLang';
const useChatContextActions = ({
chat,
user,
handleDelete,
handleChatFolderChange,
folderId,
isPinned,
isMuted,
canChangeFolder,
handleDelete,
handleChatFolderChange,
}: {
chat: ApiChat | undefined;
user: ApiUser | undefined;
handleDelete: () => void;
handleChatFolderChange: () => void;
folderId?: number;
isPinned?: boolean;
isMuted?: boolean;
canChangeFolder?: boolean;
handleDelete: () => void;
handleChatFolderChange: () => void;
}, isInSearch = false) => {
const lang = useLang();