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

View File

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