Pass promise to MessagesManager::on_dialog_deleted.
This commit is contained in:
parent
e031a2c6c1
commit
65a7715248
@ -7318,7 +7318,7 @@ void ContactsManager::delete_chat_participant(ChatId chat_id, UserId user_id, bo
|
||||
if (c->status.is_left()) {
|
||||
if (user_id == my_id) {
|
||||
if (revoke_messages) {
|
||||
td_->messages_manager_->delete_dialog(DialogId(chat_id));
|
||||
return td_->messages_manager_->delete_dialog_history(dialog_id, true, true, std::move(promise));
|
||||
}
|
||||
return promise.set_value(Unit());
|
||||
} else {
|
||||
@ -9753,7 +9753,8 @@ void ContactsManager::update_channel(Channel *c, ChannelId channel_id, bool from
|
||||
bool have_read_access = have_input_peer_channel(c, channel_id, AccessRights::Read);
|
||||
bool is_member = c->status.is_member();
|
||||
if (c->had_read_access && !have_read_access) {
|
||||
send_closure_later(G()->messages_manager(), &MessagesManager::delete_dialog, DialogId(channel_id));
|
||||
send_closure_later(G()->messages_manager(), &MessagesManager::on_dialog_deleted, DialogId(channel_id),
|
||||
Promise<Unit>());
|
||||
} else if (!from_database && c->was_member != is_member) {
|
||||
DialogId dialog_id(channel_id);
|
||||
send_closure_later(G()->messages_manager(), &MessagesManager::force_create_dialog, dialog_id, "update channel",
|
||||
|
@ -10868,11 +10868,11 @@ void MessagesManager::delete_all_dialog_messages(Dialog *d, bool remove_from_dia
|
||||
send_update_delete_messages(d->dialog_id, std::move(deleted_message_ids), is_permanently_deleted, false);
|
||||
}
|
||||
|
||||
void MessagesManager::delete_dialog(DialogId dialog_id) {
|
||||
void MessagesManager::on_dialog_deleted(DialogId dialog_id, Promise<Unit> &&promise) {
|
||||
LOG(INFO) << "Delete " << dialog_id;
|
||||
Dialog *d = get_dialog_force(dialog_id);
|
||||
if (d == nullptr) {
|
||||
return;
|
||||
return promise.set_value(Unit());
|
||||
}
|
||||
|
||||
delete_all_dialog_messages(d, true, false);
|
||||
@ -10885,6 +10885,7 @@ void MessagesManager::delete_dialog(DialogId dialog_id) {
|
||||
}
|
||||
|
||||
close_dialog(d);
|
||||
promise.set_value(Unit());
|
||||
}
|
||||
|
||||
void MessagesManager::on_update_dialog_group_call_rights(DialogId dialog_id) {
|
||||
|
@ -342,7 +342,7 @@ class MessagesManager : public Actor {
|
||||
|
||||
void delete_dialog_messages_from_user(DialogId dialog_id, UserId user_id, Promise<Unit> &&promise);
|
||||
|
||||
void delete_dialog(DialogId dialog_id);
|
||||
void on_dialog_deleted(DialogId dialog_id, Promise<Unit> &&promise);
|
||||
|
||||
void on_update_dialog_group_call_rights(DialogId dialog_id);
|
||||
|
||||
|
@ -5484,8 +5484,7 @@ void Td::on_request(uint64 id, const td_api::deleteChat &request) {
|
||||
if (result.is_error()) {
|
||||
promise.set_error(result.move_as_error());
|
||||
} else {
|
||||
send_closure(actor_id, &MessagesManager::delete_dialog, dialog_id);
|
||||
promise.set_value(Unit());
|
||||
send_closure(actor_id, &MessagesManager::on_dialog_deleted, dialog_id, std::move(promise));
|
||||
}
|
||||
};
|
||||
contacts_manager_->delete_dialog(dialog_id, std::move(query_promise));
|
||||
|
Loading…
x
Reference in New Issue
Block a user