From bee4ec5ddfb45904efa0f6cef96580cf33d3fab1 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Fri, 3 Oct 2025 13:07:18 +0300 Subject: [PATCH] Added ability to filter new tagger for self forwards with opened chat. --- Telegram/SourceFiles/history/history_widget.cpp | 3 ++- .../history/view/history_view_chat_section.cpp | 3 ++- .../view/history_view_self_forwards_tagger.cpp | 11 +++++++++-- .../history/view/history_view_self_forwards_tagger.h | 6 +++++- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index b17dd7e90b..04f55a977c 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -1023,7 +1023,8 @@ HistoryWidget::HistoryWidget( controller, this, [=] { return _list; }, - _scroll.data()); + _scroll.data(), + [=] { return _history; }); if (session().supportMode()) { session().data().chatListEntryRefreshes( diff --git a/Telegram/SourceFiles/history/view/history_view_chat_section.cpp b/Telegram/SourceFiles/history/view/history_view_chat_section.cpp index 8fdcada5f3..9b4911546c 100644 --- a/Telegram/SourceFiles/history/view/history_view_chat_section.cpp +++ b/Telegram/SourceFiles/history/view/history_view_chat_section.cpp @@ -443,7 +443,8 @@ ChatWidget::ChatWidget( controller, this, [=] { return _inner.data(); }, - _scroll.get()); + _scroll.get(), + [=] { return _history; }); setupTopicViewer(); setupComposeControls(); diff --git a/Telegram/SourceFiles/history/view/history_view_self_forwards_tagger.cpp b/Telegram/SourceFiles/history/view/history_view_self_forwards_tagger.cpp index 507a55f8c0..11a109d2c3 100644 --- a/Telegram/SourceFiles/history/view/history_view_self_forwards_tagger.cpp +++ b/Telegram/SourceFiles/history/view/history_view_self_forwards_tagger.cpp @@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "core/ui_integration.h" #include "data/data_session.h" #include "data/data_user.h" +#include "history/history.h" #include "history/history_item.h" #include "history/view/reactions/history_view_reactions_selector.h" #include "lang/lang_keys.h" @@ -41,11 +42,13 @@ SelfForwardsTagger::SelfForwardsTagger( not_null controller, not_null parent, Fn listWidget, - not_null scroll) + not_null scroll, + Fn history) : _controller(controller) , _parent(parent) , _listWidget(std::move(listWidget)) -, _scroll(scroll) { +, _scroll(scroll) +, _history(std::move(history)) { setup(); } @@ -54,6 +57,10 @@ SelfForwardsTagger::~SelfForwardsTagger() = default; void SelfForwardsTagger::setup() { _controller->session().data().recentSelfForwards( ) | rpl::start_with_next([=](const Data::RecentSelfForwards &data) { + const auto history = _history ? _history() : nullptr; + if (!history || history->peer->id != data.fromPeerId) { + return; + } showSelectorForMessages(data.ids); }, _lifetime); } diff --git a/Telegram/SourceFiles/history/view/history_view_self_forwards_tagger.h b/Telegram/SourceFiles/history/view/history_view_self_forwards_tagger.h index cdb6863710..a0dfda8928 100644 --- a/Telegram/SourceFiles/history/view/history_view_self_forwards_tagger.h +++ b/Telegram/SourceFiles/history/view/history_view_self_forwards_tagger.h @@ -9,6 +9,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "base/weak_ptr.h" +class History; + namespace Lottie { class Icon; } // namespace Lottie @@ -41,7 +43,8 @@ public: not_null controller, not_null parent, Fn listWidget, - not_null scroll); + not_null scroll, + Fn history); ~SelfForwardsTagger(); @@ -57,6 +60,7 @@ private: const not_null _parent; const Fn _listWidget; const not_null _scroll; + const Fn _history; base::weak_ptr _toast; rpl::lifetime _lifetime;