Do not return error for delete messages and close in closed secret chats.
GitOrigin-RevId: c63a155a6fe056dfcbe6204b5ca25de95eb1f23f
This commit is contained in:
parent
86c9234388
commit
cf1ece71a0
@ -407,6 +407,10 @@ void SecretChatActor::send_open_message(int64 random_id, Promise<> promise) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SecretChatActor::delete_message(int64 random_id, Promise<> promise) {
|
void SecretChatActor::delete_message(int64 random_id, Promise<> promise) {
|
||||||
|
if (auth_state_.state == State::Closed) {
|
||||||
|
promise.set_value(Unit());
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (close_flag_) {
|
if (close_flag_) {
|
||||||
promise.set_error(Status::Error(400, "Chat is closed"));
|
promise.set_error(Status::Error(400, "Chat is closed"));
|
||||||
return;
|
return;
|
||||||
@ -419,6 +423,10 @@ void SecretChatActor::delete_message(int64 random_id, Promise<> promise) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SecretChatActor::delete_messages(std::vector<int64> random_ids, Promise<> promise) {
|
void SecretChatActor::delete_messages(std::vector<int64> random_ids, Promise<> promise) {
|
||||||
|
if (auth_state_.state == State::Closed) {
|
||||||
|
promise.set_value(Unit());
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (close_flag_) {
|
if (close_flag_) {
|
||||||
promise.set_error(Status::Error(400, "Chat is closed"));
|
promise.set_error(Status::Error(400, "Chat is closed"));
|
||||||
return;
|
return;
|
||||||
@ -431,6 +439,10 @@ void SecretChatActor::delete_messages(std::vector<int64> random_ids, Promise<> p
|
|||||||
std::move(promise));
|
std::move(promise));
|
||||||
}
|
}
|
||||||
void SecretChatActor::delete_all_messages(Promise<> promise) {
|
void SecretChatActor::delete_all_messages(Promise<> promise) {
|
||||||
|
if (auth_state_.state == State::Closed) {
|
||||||
|
promise.set_value(Unit());
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (close_flag_) {
|
if (close_flag_) {
|
||||||
promise.set_error(Status::Error(400, "Chat is closed"));
|
promise.set_error(Status::Error(400, "Chat is closed"));
|
||||||
return;
|
return;
|
||||||
@ -695,7 +707,7 @@ void SecretChatActor::on_fatal_error(Status status) {
|
|||||||
|
|
||||||
void SecretChatActor::cancel_chat(Promise<> promise) {
|
void SecretChatActor::cancel_chat(Promise<> promise) {
|
||||||
if (close_flag_) {
|
if (close_flag_) {
|
||||||
promise.set_error(Status::Error(400, "Chat is already closing"));
|
promise.set_value(Unit());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
close_flag_ = true;
|
close_flag_ = true;
|
||||||
|
Reference in New Issue
Block a user