Fix SleepActor usages.
This commit is contained in:
parent
a160241db7
commit
9e1147bc89
@ -7478,6 +7478,10 @@ void ContactsManager::delete_chat_participant(ChatId chat_id, UserId user_id, bo
|
||||
void ContactsManager::restrict_channel_participant(ChannelId channel_id, DialogId participant_dialog_id,
|
||||
DialogParticipantStatus status, DialogParticipantStatus old_status,
|
||||
Promise<Unit> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
|
||||
LOG(INFO) << "Restrict " << participant_dialog_id << " in " << channel_id << " from " << old_status << " to "
|
||||
<< status;
|
||||
const Channel *c = get_channel(channel_id);
|
||||
@ -7535,22 +7539,22 @@ void ContactsManager::restrict_channel_participant(ChannelId channel_id, DialogI
|
||||
|
||||
if (old_status.is_member() && !status.is_member() && !status.is_banned()) {
|
||||
// we can't make participant Left without kicking it first
|
||||
auto on_result_promise = PromiseCreator::lambda([channel_id, participant_dialog_id, status,
|
||||
promise = std::move(promise)](Result<> result) mutable {
|
||||
auto on_result_promise = PromiseCreator::lambda([actor_id = actor_id(this), channel_id, participant_dialog_id,
|
||||
status, promise = std::move(promise)](Result<> result) mutable {
|
||||
if (result.is_error()) {
|
||||
return promise.set_error(result.move_as_error());
|
||||
}
|
||||
|
||||
create_actor<SleepActor>("RestrictChannelParticipantSleepActor", 1.0,
|
||||
PromiseCreator::lambda([channel_id, participant_dialog_id, status,
|
||||
PromiseCreator::lambda([actor_id, channel_id, participant_dialog_id, status,
|
||||
promise = std::move(promise)](Result<> result) mutable {
|
||||
if (result.is_error()) {
|
||||
return promise.set_error(result.move_as_error());
|
||||
}
|
||||
|
||||
send_closure(G()->contacts_manager(), &ContactsManager::restrict_channel_participant,
|
||||
channel_id, participant_dialog_id, status,
|
||||
DialogParticipantStatus::Banned(0), std::move(promise));
|
||||
send_closure(actor_id, &ContactsManager::restrict_channel_participant, channel_id,
|
||||
participant_dialog_id, status, DialogParticipantStatus::Banned(0),
|
||||
std::move(promise));
|
||||
}))
|
||||
.release();
|
||||
});
|
||||
|
@ -8138,6 +8138,10 @@ void MessagesManager::repair_dialog_active_group_call_id(DialogId dialog_id) {
|
||||
}
|
||||
|
||||
void MessagesManager::do_repair_dialog_active_group_call_id(DialogId dialog_id) {
|
||||
if (G()->close_flag()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Dialog *d = get_dialog(dialog_id);
|
||||
CHECK(d != nullptr);
|
||||
bool need_repair_active_group_call_id = d->has_active_group_call && !d->active_group_call_id.is_valid();
|
||||
@ -17344,6 +17348,10 @@ void MessagesManager::get_dialog_info_full(DialogId dialog_id, Promise<Unit> &&p
|
||||
}
|
||||
|
||||
void MessagesManager::reload_dialog_info_full(DialogId dialog_id) {
|
||||
if (G()->close_flag()) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (dialog_id.get_type()) {
|
||||
case DialogType::User:
|
||||
send_closure_later(G()->contacts_manager(), &ContactsManager::reload_user_full, dialog_id.get_user_id());
|
||||
@ -30562,6 +30570,9 @@ uint64 MessagesManager::save_get_dialog_from_server_log_event(DialogId dialog_id
|
||||
|
||||
void MessagesManager::send_get_dialog_query(DialogId dialog_id, Promise<Unit> &&promise, uint64 log_event_id,
|
||||
const char *source) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
if (td_->auth_manager_->is_bot() || dialog_id.get_type() == DialogType::SecretChat) {
|
||||
if (log_event_id != 0) {
|
||||
binlog_erase(G()->td_db()->get_binlog(), log_event_id);
|
||||
|
Loading…
Reference in New Issue
Block a user