Do not return empty sticker sets.
GitOrigin-RevId: 987492861215c593f7d9b9a6d475f63dd07b6e5e
This commit is contained in:
parent
2702806a89
commit
f856a383ad
@ -816,9 +816,19 @@ tl_object_ptr<td_api::stickerSets> StickersManager::get_sticker_sets_object(int3
|
||||
vector<tl_object_ptr<td_api::stickerSetInfo>> result;
|
||||
result.reserve(sticker_set_ids.size());
|
||||
for (auto sticker_set_id : sticker_set_ids) {
|
||||
result.push_back(get_sticker_set_info_object(sticker_set_id, covers_limit));
|
||||
auto sticker_set_info = get_sticker_set_info_object(sticker_set_id, covers_limit);
|
||||
if (sticker_set_info->size_ != 0) {
|
||||
result.push_back(std::move(sticker_set_info));
|
||||
}
|
||||
}
|
||||
|
||||
auto result_size = narrow_cast<int32>(result.size());
|
||||
if (total_count < result_size) {
|
||||
if (total_count != -1) {
|
||||
LOG(ERROR) << "Have total_count = " << total_count << ", but there are " << result_size << " results";
|
||||
}
|
||||
total_count = result_size;
|
||||
}
|
||||
return make_tl_object<td_api::stickerSets>(total_count, std::move(result));
|
||||
}
|
||||
|
||||
@ -3143,9 +3153,9 @@ void StickersManager::send_update_featured_sticker_sets() {
|
||||
need_update_featured_sticker_sets_ = false;
|
||||
featured_sticker_sets_hash_ = get_featured_sticker_sets_hash();
|
||||
|
||||
send_closure(G()->td(), &Td::send_update,
|
||||
make_tl_object<td_api::updateTrendingStickerSets>(get_sticker_sets_object(
|
||||
narrow_cast<int32>(featured_sticker_set_ids_.size()), featured_sticker_set_ids_, 5)));
|
||||
send_closure(
|
||||
G()->td(), &Td::send_update,
|
||||
make_tl_object<td_api::updateTrendingStickerSets>(get_sticker_sets_object(-1, featured_sticker_set_ids_, 5)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2570,8 +2570,7 @@ class GetInstalledStickerSetsRequest : public RequestActor<> {
|
||||
}
|
||||
|
||||
void do_send_result() override {
|
||||
send_result(td->stickers_manager_->get_sticker_sets_object(narrow_cast<int32>(sticker_set_ids_.size()),
|
||||
sticker_set_ids_, 1));
|
||||
send_result(td->stickers_manager_->get_sticker_sets_object(-1, sticker_set_ids_, 1));
|
||||
}
|
||||
|
||||
public:
|
||||
@ -2615,8 +2614,7 @@ class GetTrendingStickerSetsRequest : public RequestActor<> {
|
||||
}
|
||||
|
||||
void do_send_result() override {
|
||||
send_result(td->stickers_manager_->get_sticker_sets_object(narrow_cast<int32>(sticker_set_ids_.size()),
|
||||
sticker_set_ids_, 5));
|
||||
send_result(td->stickers_manager_->get_sticker_sets_object(-1, sticker_set_ids_, 5));
|
||||
}
|
||||
|
||||
public:
|
||||
@ -2634,8 +2632,7 @@ class GetAttachedStickerSetsRequest : public RequestActor<> {
|
||||
}
|
||||
|
||||
void do_send_result() override {
|
||||
send_result(td->stickers_manager_->get_sticker_sets_object(narrow_cast<int32>(sticker_set_ids_.size()),
|
||||
sticker_set_ids_, 5));
|
||||
send_result(td->stickers_manager_->get_sticker_sets_object(-1, sticker_set_ids_, 5));
|
||||
}
|
||||
|
||||
public:
|
||||
|
Loading…
Reference in New Issue
Block a user