diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 411a660dd..62151d391 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -28944,7 +28944,7 @@ NotificationGroupId MessagesManager::get_dialog_notification_group_id(DialogId d if (!next_notification_group_id.is_valid()) { return NotificationGroupId(); } - } while (get_message_notification_group_force(next_notification_group_id).dialog_id.is_valid()); + } while (td_->notification_manager_->have_group_force(next_notification_group_id)); group_info = NotificationGroupInfo(next_notification_group_id); VLOG(notifications) << "Assign " << next_notification_group_id << " to " << dialog_id; on_dialog_updated(dialog_id, "get_dialog_notification_group_id"); diff --git a/td/telegram/NotificationManager.cpp b/td/telegram/NotificationManager.cpp index 6c016528a..0d2dbc0ae 100644 --- a/td/telegram/NotificationManager.cpp +++ b/td/telegram/NotificationManager.cpp @@ -392,10 +392,18 @@ void NotificationManager::load_group_force(NotificationGroupId group_id) { return; } - auto group_it = get_group_force(group_id, true); + auto group_it = get_group_force(group_id); CHECK(group_it != groups_.end()); } +bool NotificationManager::have_group_force(NotificationGroupId group_id) { + if (is_disabled()) { + return false; + } + + return td::contains(call_notification_group_ids_, group_id) || get_group_force(group_id) != groups_.end(); +} + NotificationManager::NotificationGroups::iterator NotificationManager::get_group_force(NotificationGroupId group_id, bool send_update) { auto group_it = get_group(group_id); diff --git a/td/telegram/NotificationManager.h b/td/telegram/NotificationManager.h index 16aab4e86..2d4414b4b 100644 --- a/td/telegram/NotificationManager.h +++ b/td/telegram/NotificationManager.h @@ -67,6 +67,8 @@ class NotificationManager final : public Actor { void load_group_force(NotificationGroupId group_id); + bool have_group_force(NotificationGroupId group_id); + void add_notification(NotificationGroupId group_id, NotificationGroupType group_type, DialogId dialog_id, int32 date, DialogId notification_settings_dialog_id, bool disable_notification, int64 ringtone_id, int32 min_delay_ms, NotificationId notification_id, unique_ptr type,