Use MultiPromise to delete messages from server.
GitOrigin-RevId: 8fa8b27bfb4d3d394016e8b4fd18ea56294dae7a
This commit is contained in:
parent
d9160fd52c
commit
b78507e81d
@ -8217,13 +8217,13 @@ void MessagesManager::delete_messages(DialogId dialog_id, const vector<MessageId
|
|||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO MultiPromise
|
MultiPromiseActorSafe mpas{"DeleteMessagesFromServerMultiPromiseActor"};
|
||||||
if (!deleted_server_message_ids.empty()) {
|
mpas.add_promise(std::move(promise));
|
||||||
delete_messages_from_server(dialog_id, std::move(deleted_server_message_ids), revoke, 0, std::move(promise));
|
|
||||||
}
|
auto lock = mpas.get_promise();
|
||||||
if (!deleted_scheduled_message_ids.empty()) {
|
delete_messages_from_server(dialog_id, std::move(deleted_server_message_ids), revoke, 0, mpas.get_promise());
|
||||||
delete_scheduled_messages_from_server(dialog_id, std::move(deleted_scheduled_message_ids), 0, std::move(promise));
|
delete_scheduled_messages_from_server(dialog_id, std::move(deleted_scheduled_message_ids), 0, mpas.get_promise());
|
||||||
}
|
lock.set_value(Unit());
|
||||||
|
|
||||||
bool need_update_dialog_pos = false;
|
bool need_update_dialog_pos = false;
|
||||||
vector<int64> deleted_message_ids;
|
vector<int64> deleted_message_ids;
|
||||||
@ -8288,8 +8288,7 @@ uint64 MessagesManager::save_delete_messages_from_server_logevent(DialogId dialo
|
|||||||
void MessagesManager::delete_messages_from_server(DialogId dialog_id, vector<MessageId> message_ids, bool revoke,
|
void MessagesManager::delete_messages_from_server(DialogId dialog_id, vector<MessageId> message_ids, bool revoke,
|
||||||
uint64 logevent_id, Promise<Unit> &&promise) {
|
uint64 logevent_id, Promise<Unit> &&promise) {
|
||||||
if (message_ids.empty()) {
|
if (message_ids.empty()) {
|
||||||
promise.set_value(Unit());
|
return promise.set_value(Unit());
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
LOG(INFO) << (revoke ? "Revoke " : "Delete ") << format::as_array(message_ids) << " in " << dialog_id
|
LOG(INFO) << (revoke ? "Revoke " : "Delete ") << format::as_array(message_ids) << " in " << dialog_id
|
||||||
<< " from server";
|
<< " from server";
|
||||||
@ -8362,8 +8361,7 @@ uint64 MessagesManager::save_delete_scheduled_messages_from_server_logevent(Dial
|
|||||||
void MessagesManager::delete_scheduled_messages_from_server(DialogId dialog_id, vector<MessageId> message_ids,
|
void MessagesManager::delete_scheduled_messages_from_server(DialogId dialog_id, vector<MessageId> message_ids,
|
||||||
uint64 logevent_id, Promise<Unit> &&promise) {
|
uint64 logevent_id, Promise<Unit> &&promise) {
|
||||||
if (message_ids.empty()) {
|
if (message_ids.empty()) {
|
||||||
promise.set_value(Unit());
|
return promise.set_value(Unit());
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
LOG(INFO) << "Delete " << format::as_array(message_ids) << " in " << dialog_id << " from server";
|
LOG(INFO) << "Delete " << format::as_array(message_ids) << " in " << dialog_id << " from server";
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user