mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fix infinite group set requests on bad API responses.
This commit is contained in:
parent
9b247ce5ed
commit
8aaa70a05a
2 changed files with 39 additions and 29 deletions
|
@ -2015,7 +2015,9 @@ void StickersListWidget::refreshMegagroupStickers(GroupStickersPlace place) {
|
|||
if (canEdit && hidden) {
|
||||
removeHiddenForGroup();
|
||||
}
|
||||
if (_megagroupSet->mgInfo->stickerSet.type() == mtpc_inputStickerSetID) {
|
||||
if (_megagroupSet->mgInfo->stickerSet.type() != mtpc_inputStickerSetID) {
|
||||
return;
|
||||
}
|
||||
auto &set = _megagroupSet->mgInfo->stickerSet.c_inputStickerSetID();
|
||||
auto &sets = Auth().data().stickerSets();
|
||||
auto it = sets.constFind(set.vid.v);
|
||||
|
@ -2039,14 +2041,21 @@ void StickersListWidget::refreshMegagroupStickers(GroupStickersPlace place) {
|
|||
it->stickers);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!isShownHere(hidden)) {
|
||||
} else if (!isShownHere(hidden)
|
||||
|| _megagroupSetIdRequested == set.vid.v) {
|
||||
return;
|
||||
}
|
||||
request(MTPmessages_GetStickerSet(_megagroupSet->mgInfo->stickerSet)).done([this](const MTPmessages_StickerSet &result) {
|
||||
if (auto set = Stickers::FeedSetFull(result)) {
|
||||
_megagroupSetIdRequested = set.vid.v;
|
||||
request(MTPmessages_GetStickerSet(
|
||||
_megagroupSet->mgInfo->stickerSet
|
||||
)).done([=](const MTPmessages_StickerSet &result) {
|
||||
if (const auto set = Stickers::FeedSetFull(result)) {
|
||||
refreshStickers();
|
||||
if (set->id == _megagroupSetIdRequested) {
|
||||
_megagroupSetIdRequested = 0;
|
||||
} else {
|
||||
LOG(("API Error: Got different set."));
|
||||
}
|
||||
}
|
||||
}).send();
|
||||
}
|
||||
|
|
|
@ -246,6 +246,7 @@ private:
|
|||
void showPreview();
|
||||
|
||||
ChannelData *_megagroupSet = nullptr;
|
||||
uint64 _megagroupSetIdRequested = 0;
|
||||
std::vector<Set> _mySets;
|
||||
std::vector<Set> _featuredSets;
|
||||
std::vector<Set> _searchSets;
|
||||
|
|
Loading…
Add table
Reference in a new issue