Fix pdateActiveNotifications.
GitOrigin-RevId: 94fa89e8b7313ad7716779726ab169bbb51474b1
This commit is contained in:
parent
e5da6a5017
commit
1923170840
@ -29,6 +29,7 @@ class Notification {
|
|||||||
|
|
||||||
inline td_api::object_ptr<td_api::notification> get_notification_object(DialogId dialog_id,
|
inline td_api::object_ptr<td_api::notification> get_notification_object(DialogId dialog_id,
|
||||||
const Notification ¬ification) {
|
const Notification ¬ification) {
|
||||||
|
CHECK(notification.type != nullptr);
|
||||||
return td_api::make_object<td_api::notification>(notification.notification_id.get(), notification.date,
|
return td_api::make_object<td_api::notification>(notification.notification_id.get(), notification.date,
|
||||||
notification.type->get_notification_type_object(dialog_id));
|
notification.type->get_notification_type_object(dialog_id));
|
||||||
}
|
}
|
||||||
|
@ -324,13 +324,17 @@ td_api::object_ptr<td_api::updateActiveNotifications> NotificationManager::get_u
|
|||||||
needed_groups--;
|
needed_groups--;
|
||||||
|
|
||||||
vector<td_api::object_ptr<td_api::notification>> notifications;
|
vector<td_api::object_ptr<td_api::notification>> notifications;
|
||||||
for (auto ¬ification : group.second.notifications) {
|
for (auto ¬ification : reversed(group.second.notifications)) {
|
||||||
auto notification_object = get_notification_object(group.first.dialog_id, notification);
|
auto notification_object = get_notification_object(group.first.dialog_id, notification);
|
||||||
if (notification_object->type_ != nullptr) {
|
if (notification_object->type_ != nullptr) {
|
||||||
notifications.push_back(std::move(notification_object));
|
notifications.push_back(std::move(notification_object));
|
||||||
}
|
}
|
||||||
|
if (notifications.size() == max_notification_group_size_) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!notifications.empty()) {
|
if (!notifications.empty()) {
|
||||||
|
std::reverse(notifications.begin(), notifications.end());
|
||||||
groups.push_back(td_api::make_object<td_api::notificationGroup>(
|
groups.push_back(td_api::make_object<td_api::notificationGroup>(
|
||||||
group.first.group_id.get(), get_notification_group_type_object(group.second.type),
|
group.first.group_id.get(), get_notification_group_type_object(group.second.type),
|
||||||
group.first.dialog_id.get(), group.second.total_count, std::move(notifications)));
|
group.first.dialog_id.get(), group.second.total_count, std::move(notifications)));
|
||||||
|
Loading…
Reference in New Issue
Block a user