From db0726364b7037ab3cc69167cde07588cb81259f Mon Sep 17 00:00:00 2001
From: 23rd <23rd@vivaldi.net>
Date: Fri, 17 Oct 2025 13:27:13 +0300
Subject: [PATCH] Added report button to action buttons in profile top bar.
---
Telegram/Resources/icons/profile/report.svg | 3 +++
Telegram/Resources/langs/lang.strings | 1 +
Telegram/SourceFiles/info/info.style | 1 +
.../info/profile/info_profile_top_bar.cpp | 16 ++++++++++++++++
4 files changed, 21 insertions(+)
create mode 100644 Telegram/Resources/icons/profile/report.svg
diff --git a/Telegram/Resources/icons/profile/report.svg b/Telegram/Resources/icons/profile/report.svg
new file mode 100644
index 0000000000..2dc982d75f
--- /dev/null
+++ b/Telegram/Resources/icons/profile/report.svg
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings
index 3e3f192b2b..426066ae33 100644
--- a/Telegram/Resources/langs/lang.strings
+++ b/Telegram/Resources/langs/lang.strings
@@ -1677,6 +1677,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_profile_action_short_discuss" = "Discuss";
"lng_profile_action_short_gift" = "Gift";
"lng_profile_action_short_join" = "Join";
+"lng_profile_action_short_report" = "Report";
"lng_media_type_photos" = "Photos";
"lng_media_type_gifs" = "GIFs";
diff --git a/Telegram/SourceFiles/info/info.style b/Telegram/SourceFiles/info/info.style
index e1fe7773a1..f7159fe1c6 100644
--- a/Telegram/SourceFiles/info/info.style
+++ b/Telegram/SourceFiles/info/info.style
@@ -417,6 +417,7 @@ infoProfileTopBarActionUnmute: icon{{ "profile/unmute-22x22", premiumButtonFg }}
infoProfileTopBarActionCall: icon{{ "profile/call-22x22", premiumButtonFg }};
infoProfileTopBarActionGift: icon{{ "profile/gift-22x22", premiumButtonFg }};
infoProfileTopBarActionJoin: icon{{ "profile/join-22x22", premiumButtonFg }};
+infoProfileTopBarActionReport: icon{{ "profile/report-22x22", premiumButtonFg }};
infoMinimalWidth: 324px;
infoDesiredWidth: 392px;
diff --git a/Telegram/SourceFiles/info/profile/info_profile_top_bar.cpp b/Telegram/SourceFiles/info/profile/info_profile_top_bar.cpp
index 5bc3734cc6..b268183c06 100644
--- a/Telegram/SourceFiles/info/profile/info_profile_top_bar.cpp
+++ b/Telegram/SourceFiles/info/profile/info_profile_top_bar.cpp
@@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/timer_rpl.h"
#include "base/timer.h"
#include "base/unixtime.h"
+#include "boxes/report_messages_box.h"
#include "boxes/star_gift_box.h"
#include "calls/calls_instance.h"
#include "chat_helpers/stickers_lottie.h"
@@ -20,6 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/components/recent_shared_media_gifts.h"
#include "data/data_changes.h"
#include "data/data_channel.h"
+#include "data/data_chat.h"
#include "data/data_document_media.h"
#include "data/data_document.h"
#include "data/data_emoji_statuses.h"
@@ -551,6 +553,20 @@ void TopBar::setupActions(not_null controller) {
buttons.push_back(giftButton);
}
}
+ if (!topic
+ && ((chat && !chat->amCreator())
+ || (channel && !channel->amCreator()))) {
+ const auto show = controller->parentController()->uiShow();
+ const auto reportButton = Ui::CreateChild(
+ this,
+ tr::lng_profile_action_short_report(tr::now),
+ st::infoProfileTopBarActionReport);
+ reportButton->setClickedCallback([=] {
+ ShowReportMessageBox(show, peer, {}, {});
+ });
+ _actions->add(reportButton);
+ buttons.push_back(reportButton);
+ }
_edgeColor.value() | rpl::map(mapped) | rpl::start_with_next([=](
QColor c) {
for (const auto &button : buttons) {