2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Top peers context menu.

This commit is contained in:
John Preston
2024-04-11 13:12:57 +04:00
parent 56e28feb00
commit 19ae76d8de
8 changed files with 126 additions and 18 deletions

View File

@@ -56,6 +56,19 @@ rpl::producer<> TopPeers::updates() const {
return _updates.events();
}
void TopPeers::remove(not_null<PeerData*> peer) {
const auto i = ranges::find(_list, peer, &TopPeer::peer);
if (i != end(_list)) {
_list.erase(i);
_updates.fire({});
}
_requestId = _session->api().request(MTPcontacts_ResetTopPeerRating(
MTP_topPeerCategoryCorrespondents(),
peer->input
)).send();
}
void TopPeers::increment(not_null<PeerData*> peer, TimeId date) {
if (date <= _lastReceivedDate) {
return;

View File

@@ -22,6 +22,7 @@ public:
[[nodiscard]] bool disabled() const;
[[nodiscard]] rpl::producer<> updates() const;
void remove(not_null<PeerData*> peer);
void increment(not_null<PeerData*> peer, TimeId date);
void reload();