Add and use BackgroundId::is_local.

This commit is contained in:
levlam 2021-06-09 17:14:10 +03:00
parent 197992da2c
commit d10cc1eb77
2 changed files with 5 additions and 1 deletions

View File

@ -42,6 +42,10 @@ class BackgroundId {
return id != 0;
}
bool is_local() const {
return 0 < id && id <= 0x7FFFFFFF;
}
template <class StorerT>
void store(StorerT &storer) const {
td::store(id, storer);

View File

@ -753,7 +753,7 @@ void BackgroundManager::remove_background(BackgroundId background_id, Promise<Un
});
if (!background->type.has_file()) {
if (background->is_default) {
if (!background->id.is_local()) {
return td_->create_handler<UnsaveBackgroundQuery>(std::move(query_promise))
->send(telegram_api::make_object<telegram_api::inputWallPaperNoFile>(background_id.get()));
} else {