Compare stickers and animation by their remote ID when remove them from recent/saved.

This commit is contained in:
levlam 2022-07-03 12:17:04 +03:00
parent d75791481f
commit d489014350
2 changed files with 9 additions and 2 deletions

View File

@ -796,7 +796,11 @@ void AnimationsManager::remove_saved_animation(const tl_object_ptr<td_api::Input
}
FileId file_id = r_file_id.ok();
if (!td::remove(saved_animation_ids_, file_id)) {
auto is_equal = [animation_id = file_id](FileId file_id) {
return file_id == animation_id ||
(file_id.get_remote() == animation_id.get_remote() && animation_id.get_remote() != 0);
};
if (!td::remove_if(saved_animation_ids_, is_equal)) {
return promise.set_value(Unit());
}

View File

@ -7236,7 +7236,10 @@ void StickersManager::remove_favorite_sticker(const tl_object_ptr<td_api::InputF
}
FileId file_id = r_file_id.ok();
if (!td::remove(favorite_sticker_ids_, file_id)) {
auto is_equal = [sticker_id = file_id](FileId file_id) {
return file_id == sticker_id || (file_id.get_remote() == sticker_id.get_remote() && sticker_id.get_remote() != 0);
};
if (!td::remove_if(favorite_sticker_ids_, is_equal)) {
return promise.set_value(Unit());
}