Added ability to filter new tagger for self forwards with opened chat.

This commit is contained in:
23rd
2025-10-03 13:07:18 +03:00
committed by John Preston
parent 29f533b170
commit bee4ec5ddf
4 changed files with 18 additions and 5 deletions
@@ -1023,7 +1023,8 @@ HistoryWidget::HistoryWidget(
controller,
this,
[=] { return _list; },
_scroll.data());
_scroll.data(),
[=] { return _history; });
if (session().supportMode()) {
session().data().chatListEntryRefreshes(
@@ -443,7 +443,8 @@ ChatWidget::ChatWidget(
controller,
this,
[=] { return _inner.data(); },
_scroll.get());
_scroll.get(),
[=] { return _history; });
setupTopicViewer();
setupComposeControls();
@@ -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<Window::SessionController*> controller,
not_null<Ui::RpWidget*> parent,
Fn<Ui::RpWidget*()> listWidget,
not_null<QWidget*> scroll)
not_null<QWidget*> scroll,
Fn<History*()> 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);
}
@@ -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<Window::SessionController*> controller,
not_null<Ui::RpWidget*> parent,
Fn<Ui::RpWidget*()> listWidget,
not_null<QWidget*> scroll);
not_null<QWidget*> scroll,
Fn<History*()> history);
~SelfForwardsTagger();
@@ -57,6 +60,7 @@ private:
const not_null<Ui::RpWidget*> _parent;
const Fn<Ui::RpWidget*()> _listWidget;
const not_null<QWidget*> _scroll;
const Fn<History*()> _history;
base::weak_ptr<Ui::Toast::Instance> _toast;
rpl::lifetime _lifetime;