From 1433b3d82a654310ee05428509eabb3b801b8c32 Mon Sep 17 00:00:00 2001 From: levlam Date: Wed, 11 Mar 2020 01:36:47 +0300 Subject: [PATCH] Do not allow to archive saved messages and 777000. GitOrigin-RevId: 570ec48d7347ebaf4ea3a35847d95714b5fcf741 --- td/generate/scheme/td_api.tl | 2 +- td/telegram/MessagesManager.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index d844b0ed8..6f36c92a7 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -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 diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index c3d11ab7c..bb511a278 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -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")); }