Reload all sticker sets once to drop legacy photo locations.

GitOrigin-RevId: 2ab5e1ba035ea3946a733a06e44cc1f7b327cd36
This commit is contained in:
levlam 2020-10-31 01:32:18 +03:00
parent 0cc4767839
commit 0efc6ee617
3 changed files with 8 additions and 3 deletions

View File

@ -2175,6 +2175,7 @@ StickerSetId StickersManager::on_get_sticker_set(tl_object_ptr<telegram_api::sti
s->short_name = std::move(set->short_name_);
s->thumbnail = std::move(thumbnail);
s->is_thumbnail_reloaded = true;
s->are_legacy_thumbnails_reloaded = true;
s->sticker_count = set->count_;
s->hash = set->hash_;
s->is_official = is_official;
@ -2213,9 +2214,10 @@ StickerSetId StickersManager::on_get_sticker_set(tl_object_ptr<telegram_api::sti
s->thumbnail = std::move(thumbnail);
s->is_changed = true;
}
if (!s->is_thumbnail_reloaded) {
LOG(INFO) << "Thumbnail of " << set_id << " was reloaded";
if (!s->is_thumbnail_reloaded || !s->are_legacy_thumbnails_reloaded) {
LOG(INFO) << "Sticker thumbnails and thumbnail of " << set_id << " was reloaded";
s->is_thumbnail_reloaded = true;
s->are_legacy_thumbnails_reloaded = true;
s->need_save_to_database = true;
}
@ -3397,7 +3399,7 @@ void StickersManager::on_load_sticker_set_from_database(StickerSetId sticker_set
<< format::as_hex_dump<4>(Slice(value));
}
}
if (!sticker_set->is_thumbnail_reloaded) {
if (!sticker_set->is_thumbnail_reloaded || !sticker_set->are_legacy_thumbnails_reloaded) {
do_reload_sticker_set(sticker_set_id, get_input_sticker_set(sticker_set), Auto());
}

View File

@ -344,6 +344,7 @@ class StickersManager : public Actor {
bool is_masks = false;
bool is_viewed = true;
bool is_thumbnail_reloaded = false;
bool are_legacy_thumbnails_reloaded = false;
mutable bool was_update_sent = false; // does the sticker set is known to the client
bool is_changed = true; // have new changes that need to be sent to the client and database
bool need_save_to_database = true; // have new changes that need only to be saved to the database

View File

@ -132,6 +132,7 @@ void StickersManager::store_sticker_set(const StickerSet *sticker_set, bool with
STORE_FLAG(has_thumbnail);
STORE_FLAG(sticker_set->is_thumbnail_reloaded);
STORE_FLAG(sticker_set->is_animated);
STORE_FLAG(sticker_set->are_legacy_thumbnails_reloaded);
END_STORE_FLAGS();
store(sticker_set->id.get(), storer);
store(sticker_set->access_hash, storer);
@ -190,6 +191,7 @@ void StickersManager::parse_sticker_set(StickerSet *sticker_set, ParserT &parser
PARSE_FLAG(has_thumbnail);
PARSE_FLAG(sticker_set->is_thumbnail_reloaded);
PARSE_FLAG(is_animated);
PARSE_FLAG(sticker_set->are_legacy_thumbnails_reloaded);
END_PARSE_FLAGS();
int64 sticker_set_id;
int64 access_hash;