2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Fixed Api requests for statistics with non-default DC.

This commit is contained in:
23rd
2023-11-11 14:58:44 +03:00
parent 468d4c5e4f
commit 1e6cf839e2
7 changed files with 41 additions and 61 deletions

View File

@@ -1120,6 +1120,10 @@ void ApplyChannelUpdate(
channel,
update.vnotify_settings());
if (update.vstats_dc()) {
channel->owner().applyStatsDcId(channel, update.vstats_dc()->v);
}
if (const auto sendAs = update.vdefault_send_as()) {
session->sendAsPeers().setChosen(channel, peerFromMTP(*sendAs));
} else {

View File

@@ -4532,6 +4532,15 @@ uint64 Session::wallpapersHash() const {
return _wallpapersHash;
}
MTP::DcId Session::statsDcId(not_null<ChannelData*> channel) {
const auto it = _channelStatsDcIds.find(channel);
return (it == end(_channelStatsDcIds)) ? MTP::DcId(0) : it->second;
}
void Session::applyStatsDcId(not_null<ChannelData*> channel, MTP::DcId dcId) {
_channelStatsDcIds[channel] = dcId;
}
void Session::webViewResultSent(WebViewResultSent &&sent) {
return _webViewResultSent.fire(std::move(sent));
}

View File

@@ -730,6 +730,9 @@ public:
[[nodiscard]] auto peerDecorationsUpdated() const
-> rpl::producer<not_null<PeerData*>>;
void applyStatsDcId(not_null<ChannelData*>, MTP::DcId);
[[nodiscard]] MTP::DcId statsDcId(not_null<ChannelData*>);
void clearLocalStorage();
private:
@@ -1014,6 +1017,8 @@ private:
base::flat_map<not_null<UserData*>, TimeId> _watchingForOffline;
base::Timer _watchForOfflineTimer;
base::flat_map<not_null<ChannelData*>, MTP::DcId> _channelStatsDcIds;
rpl::event_stream<WebViewResultSent> _webViewResultSent;
rpl::event_stream<not_null<PeerData*>> _peerDecorationsUpdated;