diff --git a/Telegram/SourceFiles/main/session/send_as_peers.cpp b/Telegram/SourceFiles/main/session/send_as_peers.cpp index a3ef575a4..4d1532318 100644 --- a/Telegram/SourceFiles/main/session/send_as_peers.cpp +++ b/Telegram/SourceFiles/main/session/send_as_peers.cpp @@ -37,7 +37,7 @@ SendAsPeers::SendAsPeers(not_null session) ) | rpl::filter([=](not_null peer, bool, bool) { return _lists.contains(peer); }) | rpl::start_with_next([=](not_null peer, bool, bool) { - refresh(peer); + refresh(peer, true); }, _lifetime); } @@ -46,14 +46,14 @@ bool SendAsPeers::shouldChoose(not_null peer) { return peer->canWrite() && (list(peer).size() > 1); } -void SendAsPeers::refresh(not_null peer) { +void SendAsPeers::refresh(not_null peer, bool force) { if (!peer->isMegagroup()) { return; } const auto now = crl::now(); const auto i = _lastRequestTime.find(peer); const auto when = (i == end(_lastRequestTime)) ? -1 : i->second; - if (when >= 0 && now < when + kRequestEach) { + if (!force && (when >= 0 && now < when + kRequestEach)) { return; } _lastRequestTime[peer] = now; diff --git a/Telegram/SourceFiles/main/session/send_as_peers.h b/Telegram/SourceFiles/main/session/send_as_peers.h index 49663db44..302bdf02d 100644 --- a/Telegram/SourceFiles/main/session/send_as_peers.h +++ b/Telegram/SourceFiles/main/session/send_as_peers.h @@ -18,7 +18,7 @@ public: explicit SendAsPeers(not_null session); bool shouldChoose(not_null peer); - void refresh(not_null peer); + void refresh(not_null peer, bool force = false); [[nodiscard]] const std::vector> &list( not_null peer) const; [[nodiscard]] rpl::producer> updated() const;