Do not allow to archive saved messages and 777000.

GitOrigin-RevId: 570ec48d7347ebaf4ea3a35847d95714b5fcf741
This commit is contained in:
levlam 2020-03-11 01:36:47 +03:00
parent a0bf46a4d8
commit 1433b3d82a
2 changed files with 7 additions and 1 deletions

View File

@ -3567,7 +3567,7 @@ createNewSecretChat user_id:int32 = Chat;
upgradeBasicGroupChatToSupergroupChat chat_id:int53 = Chat;
//@description Moves a chat to a different chat list. Current chat list of the chat must ne non-null @chat_id Chat identifier @chat_list New chat list of the chat
//@description Moves a chat to a different chat list. Current chat list of the chat must ne non-null @chat_id Chat identifier @chat_list New chat list of the chat. The chat with the current user (Saved Messages) and the chat 777000 (Telegram) can't be moved to the Archive chat list
setChatChatList chat_id:int53 chat_list:ChatList = Ok;
//@description Changes the chat title. Supported only for basic groups, supergroups and channels. Requires can_change_info rights. The title will not be changed until the request to the server has been completed

View File

@ -24749,6 +24749,12 @@ void MessagesManager::set_dialog_folder_id(DialogId dialog_id, FolderId folder_i
return promise.set_value(Unit());
}
if (folder_id == FolderId::archive() &&
(dialog_id == get_my_dialog_id() ||
dialog_id == DialogId(td_->contacts_manager_->get_service_notifications_user_id()))) {
return promise.set_error(Status::Error(400, "Chat can't be archived"));
}
if (!have_input_peer(dialog_id, AccessRights::Read)) {
return promise.set_error(Status::Error(6, "Can't access the chat"));
}