Simplify check that dialog can't be pinned using that if dialog is removed from chat list, then it's order is default.

GitOrigin-RevId: 914dadfc2fb505eba295092f1f723771570b1bfc
This commit is contained in:
levlam 2020-05-29 05:26:49 +03:00
parent 3f4011364b
commit b8fa651764

View File

@ -12490,7 +12490,7 @@ bool MessagesManager::set_dialog_is_pinned(DialogListId dialog_list_id, Dialog *
}
CHECK(d != nullptr);
if ((is_removed_from_dialog_list(d) || d->order == DEFAULT_ORDER) && is_pinned) {
if (d->order == DEFAULT_ORDER && is_pinned) {
// the chat can't be pinned
return false;
}
@ -16282,7 +16282,7 @@ Status MessagesManager::toggle_dialog_is_pinned(DialogListId dialog_list_id, Dia
if (!have_input_peer(dialog_id, AccessRights::Read)) {
return Status::Error(6, "Can't access the chat");
}
if ((is_removed_from_dialog_list(d) || d->order == DEFAULT_ORDER) && is_pinned) {
if (d->order == DEFAULT_ORDER && is_pinned) {
return Status::Error(6, "The chat can't be pinned");
}
@ -16414,7 +16414,7 @@ Status MessagesManager::set_pinned_dialogs(DialogListId dialog_list_id, vector<D
if (!have_input_peer(dialog_id, AccessRights::Read)) {
return Status::Error(6, "Can't access the chat");
}
if (is_removed_from_dialog_list(d) || d->order == DEFAULT_ORDER) {
if (d->order == DEFAULT_ORDER) {
return Status::Error(6, "The chat can't be pinned");
}
if (dialog_list_id.is_folder() && d->folder_id != dialog_list_id.get_folder_id()) {