Added discuss button to action buttons in profile top bar.

This commit is contained in:
23rd
2025-10-17 13:26:47 +03:00
parent f2e345b39f
commit 828d8ea051
2 changed files with 20 additions and 0 deletions
+1
View File
@@ -1674,6 +1674,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_profile_action_short_mute" = "Mute"; "lng_profile_action_short_mute" = "Mute";
"lng_profile_action_short_unmute" = "Unmute"; "lng_profile_action_short_unmute" = "Unmute";
"lng_profile_action_short_call" = "Call"; "lng_profile_action_short_call" = "Call";
"lng_profile_action_short_discuss" = "Discuss";
"lng_media_type_photos" = "Photos"; "lng_media_type_photos" = "Photos";
"lng_media_type_gifs" = "GIFs"; "lng_media_type_gifs" = "GIFs";
@@ -493,6 +493,25 @@ void TopBar::setupActions(not_null<Controller*> controller) {
user->updateFull(); user->updateFull();
} }
} }
if (const auto chat = channel ? channel->discussionLink() : nullptr) {
const auto navigation = controller->parentController();
const auto discuss = Ui::CreateChild<TopBarActionButton>(
this,
tr::lng_profile_action_short_discuss(tr::now),
st::infoProfileTopBarActionMessage);
discuss->setClickedCallback([=] {
if (channel->invitePeekExpires()) {
controller->showToast(
tr::lng_channel_invite_private(tr::now));
return;
}
navigation->showPeerHistory(
chat,
Window::SectionShow::Way::Forward);
});
_actions->add(discuss);
buttons.push_back(discuss);
}
_edgeColor.value() | rpl::map(mapped) | rpl::start_with_next([=]( _edgeColor.value() | rpl::map(mapped) | rpl::start_with_next([=](
QColor c) { QColor c) {
for (const auto &button : buttons) { for (const auto &button : buttons) {