From efc0908ed808f3e69d30777837c40ac5b54163ac Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Thu, 10 Nov 2022 21:42:15 +0300 Subject: [PATCH] Fixed forum closing with Back mouse button. - Fixed #25330. --- Telegram/SourceFiles/mainwidget.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 330681202..5131e21d6 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -2657,14 +2657,21 @@ void MainWidget::handleHistoryBack() { return; } const auto openedFolder = _controller->openedFolder().current(); - const auto rootPeer = _stack.empty() + const auto openedForum = _controller->openedForum().current(); + const auto rootPeer = !_stack.empty() + ? _stack.front()->peer() + : _history->peer() ? _history->peer() - : _stack.front()->peer(); + : _mainSection + ? _mainSection->activeChat().key.peer() + : nullptr; const auto rootHistory = rootPeer ? rootPeer->owner().historyLoaded(rootPeer) : nullptr; const auto rootFolder = rootHistory ? rootHistory->folder() : nullptr; - if (!openedFolder + if (openedForum && !rootPeer) { + _controller->closeForum(); + } else if (!openedFolder || rootFolder == openedFolder || _dialogs->isHidden()) { _controller->showBackFromStack();