mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-07-27 16:03:03 +02:00
Make less channel full requests.
This commit is contained in:
parent
ff4b9a3cfe
commit
bd5b9f5347
2 changed files with 35 additions and 14 deletions
|
@ -1060,15 +1060,9 @@ not_null<PeerData*> Session::processChat(const MTPChat &data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
channel->setPhoto(data.vphoto());
|
channel->setPhoto(data.vphoto());
|
||||||
if (const auto monoforum = data.vlinked_monoforum_id()) {
|
applyMonoforumLinkedId(
|
||||||
if (const auto linked = channelLoaded(monoforum->v)) {
|
channel,
|
||||||
channel->setMonoforumLink(linked);
|
data.vlinked_monoforum_id().value_or_empty());
|
||||||
} else {
|
|
||||||
channel->updateFull();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
channel->setMonoforumLink(nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wasInChannel != channel->amIn()) {
|
if (wasInChannel != channel->amIn()) {
|
||||||
flags |= UpdateFlag::ChannelAmIn;
|
flags |= UpdateFlag::ChannelAmIn;
|
||||||
|
@ -1152,12 +1146,31 @@ UserData *Session::processUsers(const MTPVector<MTPUser> &data) {
|
||||||
|
|
||||||
PeerData *Session::processChats(const MTPVector<MTPChat> &data) {
|
PeerData *Session::processChats(const MTPVector<MTPChat> &data) {
|
||||||
auto result = (PeerData*)nullptr;
|
auto result = (PeerData*)nullptr;
|
||||||
|
_postponedMonoforumLinkedIds.emplace();
|
||||||
for (const auto &chat : data.v) {
|
for (const auto &chat : data.v) {
|
||||||
result = processChat(chat);
|
result = processChat(chat);
|
||||||
}
|
}
|
||||||
|
const auto ids = base::take(_postponedMonoforumLinkedIds);
|
||||||
|
for (const auto &[channel, linkedId] : *ids) {
|
||||||
|
applyMonoforumLinkedId(channel, linkedId);
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Session::applyMonoforumLinkedId(
|
||||||
|
not_null<ChannelData*> channel,
|
||||||
|
ChannelId linkedId) {
|
||||||
|
if (!linkedId) {
|
||||||
|
channel->setMonoforumLink(nullptr);
|
||||||
|
} else if (_postponedMonoforumLinkedIds) {
|
||||||
|
_postponedMonoforumLinkedIds->emplace(channel, linkedId);
|
||||||
|
} else if (const auto linked = channelLoaded(linkedId)) {
|
||||||
|
channel->setMonoforumLink(linked);
|
||||||
|
} else {
|
||||||
|
channel->updateFull();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Session::applyMaximumChatVersions(const MTPVector<MTPChat> &data) {
|
void Session::applyMaximumChatVersions(const MTPVector<MTPChat> &data) {
|
||||||
for (const auto &chat : data.v) {
|
for (const auto &chat : data.v) {
|
||||||
chat.match([&](const MTPDchat &data) {
|
chat.match([&](const MTPDchat &data) {
|
||||||
|
@ -4809,11 +4822,11 @@ void Session::refreshChatListEntry(Dialogs::Key key) {
|
||||||
} else if (const auto monoforum = history->peer->monoforum()) {
|
} else if (const auto monoforum = history->peer->monoforum()) {
|
||||||
monoforum->preloadSublists();
|
monoforum->preloadSublists();
|
||||||
}
|
}
|
||||||
if (const auto broadcast = history->peer->monoforumBroadcast()) {
|
//if (const auto broadcast = history->peer->monoforumBroadcast()) {
|
||||||
if (!broadcast->isFullLoaded()) {
|
// if (!broadcast->isFullLoaded()) {
|
||||||
broadcast->updateFull();
|
// broadcast->updateFull();
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -992,6 +992,10 @@ private:
|
||||||
void setWallpapers(const QVector<MTPWallPaper> &data, uint64 hash);
|
void setWallpapers(const QVector<MTPWallPaper> &data, uint64 hash);
|
||||||
void highlightProcessDone(uint64 processId);
|
void highlightProcessDone(uint64 processId);
|
||||||
|
|
||||||
|
void applyMonoforumLinkedId(
|
||||||
|
not_null<ChannelData*> channel,
|
||||||
|
ChannelId linkedId);
|
||||||
|
|
||||||
void checkPollsClosings();
|
void checkPollsClosings();
|
||||||
|
|
||||||
const not_null<Main::Session*> _session;
|
const not_null<Main::Session*> _session;
|
||||||
|
@ -1157,6 +1161,10 @@ private:
|
||||||
|
|
||||||
std::unordered_map<PeerId, std::unique_ptr<PeerData>> _peers;
|
std::unordered_map<PeerId, std::unique_ptr<PeerData>> _peers;
|
||||||
|
|
||||||
|
std::optional<base::flat_map<
|
||||||
|
not_null<ChannelData*>,
|
||||||
|
ChannelId>> _postponedMonoforumLinkedIds;
|
||||||
|
|
||||||
MessageIdsList _mimeForwardIds;
|
MessageIdsList _mimeForwardIds;
|
||||||
|
|
||||||
std::weak_ptr<CreditsSubsRebuilder> _creditsSubsRebuilder;
|
std::weak_ptr<CreditsSubsRebuilder> _creditsSubsRebuilder;
|
||||||
|
|
Loading…
Add table
Reference in a new issue