From a2f2db30f6e25c5f0677dc807bb47a4fcd681b4d Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Wed, 24 Jun 2026 08:52:16 +0300 Subject: [PATCH] Made discussion group open in same non-primary window as its channel. --- Telegram/SourceFiles/info/profile/info_profile_top_bar.cpp | 5 +++-- Telegram/SourceFiles/mainwidget.cpp | 2 ++ Telegram/SourceFiles/window/window_session_controller.h | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/info/profile/info_profile_top_bar.cpp b/Telegram/SourceFiles/info/profile/info_profile_top_bar.cpp index 7db0dae924..a40730995a 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_top_bar.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_top_bar.cpp @@ -922,9 +922,10 @@ void TopBar::setupActions(not_null controller) { tr::lng_channel_invite_private(tr::now)); return; } - controller->showPeerHistory( - chat, + auto params = Window::SectionShow( Window::SectionShow::Way::Forward); + params.preferCurrentWindow = true; + controller->showPeerHistory(chat, params); }); discuss->setAccessibleName(tr::lng_profile_action_short_discuss(tr::now)); _actions->add(discuss); diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 51cb714070..5196e8435a 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -1354,6 +1354,8 @@ bool MainWidget::showHistoryInDifferentWindow( return true; } else if (windowId().hasChatsList()) { return false; + } else if (params.preferCurrentWindow) { + return false; } const auto account = not_null(&session().account()); auto primary = Core::App().separateWindowFor(account); diff --git a/Telegram/SourceFiles/window/window_session_controller.h b/Telegram/SourceFiles/window/window_session_controller.h index 0e912f12d0..663f53ff32 100644 --- a/Telegram/SourceFiles/window/window_session_controller.h +++ b/Telegram/SourceFiles/window/window_session_controller.h @@ -211,6 +211,7 @@ struct SectionShow { bool childColumn = false; bool forbidLayer = false; bool forceTopicsList = false; + bool preferCurrentWindow = false; bool reapplyLocalDraft = false; bool dropSameFromStack = false; bool allowDuplicateInStack = false;