Add more checks that updateNewChat was sent.

GitOrigin-RevId: deaaef2b986c3d780ad7f06007b2719ff34d7a65
This commit is contained in:
levlam 2020-02-13 01:22:25 +03:00
parent fb0bf583ea
commit a7e6deeab5
2 changed files with 7 additions and 7 deletions

View File

@ -14586,14 +14586,14 @@ void MessagesManager::update_dialog_notification_settings_on_server(DialogId dia
}); });
} }
send_update_dialog_notification_settings_query(dialog_id, std::move(promise)); send_update_dialog_notification_settings_query(d, std::move(promise));
} }
void MessagesManager::send_update_dialog_notification_settings_query(DialogId dialog_id, Promise<Unit> &&promise) { void MessagesManager::send_update_dialog_notification_settings_query(const Dialog *d, Promise<Unit> &&promise) {
auto d = get_dialog(dialog_id);
CHECK(d != nullptr); CHECK(d != nullptr);
// TODO do not send two queries simultaneously or use SequenceDispatcher // TODO do not send two queries simultaneously or use SequenceDispatcher
td_->create_handler<UpdateDialogNotifySettingsQuery>(std::move(promise))->send(dialog_id, d->notification_settings); td_->create_handler<UpdateDialogNotifySettingsQuery>(std::move(promise))
->send(d->dialog_id, d->notification_settings);
} }
void MessagesManager::on_updated_dialog_notification_settings(DialogId dialog_id, uint64 generation) { void MessagesManager::on_updated_dialog_notification_settings(DialogId dialog_id, uint64 generation) {
@ -21228,8 +21228,7 @@ void MessagesManager::on_dialog_updated(DialogId dialog_id, const char *source)
void MessagesManager::send_update_new_message(const Dialog *d, const Message *m) { void MessagesManager::send_update_new_message(const Dialog *d, const Message *m) {
CHECK(d != nullptr); CHECK(d != nullptr);
CHECK(m != nullptr); CHECK(m != nullptr);
CHECK(d->is_update_new_chat_sent);
LOG(INFO) << "Send updateNewMessage for " << m->message_id << " in " << d->dialog_id;
send_closure(G()->td(), &Td::send_update, send_closure(G()->td(), &Td::send_update,
make_tl_object<td_api::updateNewMessage>(get_message_object(d->dialog_id, m))); make_tl_object<td_api::updateNewMessage>(get_message_object(d->dialog_id, m)));
} }
@ -22420,6 +22419,7 @@ void MessagesManager::remove_message_dialog_notifications(Dialog *d, MessageId m
void MessagesManager::send_update_message_send_succeeded(Dialog *d, MessageId old_message_id, const Message *m) const { void MessagesManager::send_update_message_send_succeeded(Dialog *d, MessageId old_message_id, const Message *m) const {
CHECK(m != nullptr); CHECK(m != nullptr);
CHECK(d->is_update_new_chat_sent);
d->yet_unsent_message_id_to_persistent_message_id.emplace(old_message_id, m->message_id); d->yet_unsent_message_id_to_persistent_message_id.emplace(old_message_id, m->message_id);
send_closure( send_closure(
G()->td(), &Td::send_update, G()->td(), &Td::send_update,

View File

@ -2258,7 +2258,7 @@ class MessagesManager : public Actor {
void update_dialog_notification_settings_on_server(DialogId dialog_id, bool from_binlog); void update_dialog_notification_settings_on_server(DialogId dialog_id, bool from_binlog);
void send_update_dialog_notification_settings_query(DialogId dialog_id, Promise<Unit> &&promise); void send_update_dialog_notification_settings_query(const Dialog *d, Promise<Unit> &&promise);
void on_updated_dialog_notification_settings(DialogId dialog_id, uint64 generation); void on_updated_dialog_notification_settings(DialogId dialog_id, uint64 generation);