Forum Panel: Fix panel not opening after being closed (#3599)

This commit is contained in:
Alexander Zinchuk 2023-07-20 15:58:48 +02:00
parent 7a5088e11c
commit 01dfd7f181

View File

@ -31,6 +31,7 @@ import {
selectCurrentMessageList, selectCurrentMessageList,
selectDraft, selectDraft,
selectIsForumPanelClosed, selectIsForumPanelClosed,
selectIsForumPanelOpen,
selectNotifyExceptions, selectNotifyExceptions,
selectNotifySettings, selectNotifySettings,
selectOutgoingStatus, selectOutgoingStatus,
@ -89,6 +90,7 @@ type StateProps = {
draft?: ApiFormattedText; draft?: ApiFormattedText;
isSelected?: boolean; isSelected?: boolean;
isSelectedForum?: boolean; isSelectedForum?: boolean;
isForumPanelOpen?: boolean;
canScrollDown?: boolean; canScrollDown?: boolean;
canChangeFolder?: boolean; canChangeFolder?: boolean;
lastMessageTopic?: ApiTopic; lastMessageTopic?: ApiTopic;
@ -117,6 +119,7 @@ const Chat: FC<OwnProps & StateProps> = ({
withInterfaceAnimations, withInterfaceAnimations,
isSelected, isSelected,
isSelectedForum, isSelectedForum,
isForumPanelOpen,
canScrollDown, canScrollDown,
canChangeFolder, canChangeFolder,
lastMessageTopic, lastMessageTopic,
@ -164,7 +167,7 @@ const Chat: FC<OwnProps & StateProps> = ({
const handleClick = useLastCallback(() => { const handleClick = useLastCallback(() => {
if (isForum) { if (isForum) {
if (isSelectedForum) { if (isForumPanelOpen) {
closeForumPanel(undefined, { forceOnHeavyAnimation: true }); closeForumPanel(undefined, { forceOnHeavyAnimation: true });
} else { } else {
openForumPanel({ chatId }, { forceOnHeavyAnimation: true }); openForumPanel({ chatId }, { forceOnHeavyAnimation: true });
@ -369,6 +372,7 @@ export default memo(withGlobal<OwnProps>(
draft: selectDraft(global, chatId, MAIN_THREAD_ID), draft: selectDraft(global, chatId, MAIN_THREAD_ID),
isSelected, isSelected,
isSelectedForum, isSelectedForum,
isForumPanelOpen: selectIsForumPanelOpen(global),
canScrollDown: isSelected && messageListType === 'thread', canScrollDown: isSelected && messageListType === 'thread',
canChangeFolder: (global.chatFolders.orderedIds?.length || 0) > 1, canChangeFolder: (global.chatFolders.orderedIds?.length || 0) > 1,
...(isOutgoing && chat.lastMessage && { ...(isOutgoing && chat.lastMessage && {