mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Fix "Send As" list refresh on admin anonymity change.
This commit is contained in:
parent
8460a62588
commit
f2915064b5
2 changed files with 4 additions and 4 deletions
|
@ -37,7 +37,7 @@ SendAsPeers::SendAsPeers(not_null<Session*> session)
|
|||
) | rpl::filter([=](not_null<PeerData*> peer, bool, bool) {
|
||||
return _lists.contains(peer);
|
||||
}) | rpl::start_with_next([=](not_null<PeerData*> peer, bool, bool) {
|
||||
refresh(peer);
|
||||
refresh(peer, true);
|
||||
}, _lifetime);
|
||||
}
|
||||
|
||||
|
@ -46,14 +46,14 @@ bool SendAsPeers::shouldChoose(not_null<PeerData*> peer) {
|
|||
return peer->canWrite() && (list(peer).size() > 1);
|
||||
}
|
||||
|
||||
void SendAsPeers::refresh(not_null<PeerData*> peer) {
|
||||
void SendAsPeers::refresh(not_null<PeerData*> 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;
|
||||
|
|
|
@ -18,7 +18,7 @@ public:
|
|||
explicit SendAsPeers(not_null<Session*> session);
|
||||
|
||||
bool shouldChoose(not_null<PeerData*> peer);
|
||||
void refresh(not_null<PeerData*> peer);
|
||||
void refresh(not_null<PeerData*> peer, bool force = false);
|
||||
[[nodiscard]] const std::vector<not_null<PeerData*>> &list(
|
||||
not_null<PeerData*> peer) const;
|
||||
[[nodiscard]] rpl::producer<not_null<PeerData*>> updated() const;
|
||||
|
|
Loading…
Add table
Reference in a new issue