Add exclude_secret_chats parameter to clearAllDraftMessages.

GitOrigin-RevId: 7b08fe3e954d9e361d7e20c4341575e2101e6dbc
This commit is contained in:
levlam 2018-07-19 17:23:18 +03:00
parent 460675316c
commit fc966adca9
5 changed files with 11 additions and 9 deletions

View File

@ -2731,8 +2731,8 @@ searchChatMembers chat_id:int53 query:string limit:int32 = ChatMembers;
getChatAdministrators chat_id:int53 = Users;
//@description Clears draft messages in all chats
clearAllDraftMessages = Ok;
//@description Clears draft messages in all chats @exclude_secret_chats If true, local draft messages in secret chats will not be cleared
clearAllDraftMessages exclude_secret_chats:Bool = Ok;
//@description Returns the notification settings for chats of a given type @scope Types of chats for which to return the notification settings information

Binary file not shown.

View File

@ -12762,11 +12762,13 @@ void MessagesManager::on_saved_dialog_draft_message(DialogId dialog_id, uint64 g
}
}
void MessagesManager::clear_all_draft_messages(Promise<Unit> &&promise) {
for (auto &dialog : dialogs_) {
Dialog *d = dialog.second.get();
if (d->dialog_id.get_type() == DialogType::SecretChat) {
update_dialog_draft_message(d, nullptr, false, true);
void MessagesManager::clear_all_draft_messages(bool exclude_secret_chats, Promise<Unit> &&promise) {
if (!exclude_secret_chats) {
for (auto &dialog : dialogs_) {
Dialog *d = dialog.second.get();
if (d->dialog_id.get_type() == DialogType::SecretChat) {
update_dialog_draft_message(d, nullptr, false, true);
}
}
}
td_->create_handler<ClearAllDraftsQuery>(std::move(promise))->send();

View File

@ -1231,7 +1231,7 @@ class MessagesManager : public Actor {
Status set_dialog_draft_message(DialogId dialog_id,
tl_object_ptr<td_api::draftMessage> &&draft_message) TD_WARN_UNUSED_RESULT;
void clear_all_draft_messages(Promise<Unit> &&promise);
void clear_all_draft_messages(bool exclude_secret_chats, Promise<Unit> &&promise);
Status toggle_dialog_is_pinned(DialogId dialog_id, bool is_pinned) TD_WARN_UNUSED_RESULT;

View File

@ -5509,7 +5509,7 @@ void Td::on_request(uint64 id, td_api::getChatEventLog &request) {
void Td::on_request(uint64 id, const td_api::clearAllDraftMessages &request) {
CHECK_IS_USER();
CREATE_OK_REQUEST_PROMISE();
messages_manager_->clear_all_draft_messages(std::move(promise));
messages_manager_->clear_all_draft_messages(request.exclude_secret_chats_, std::move(promise));
}
void Td::on_request(uint64 id, const td_api::downloadFile &request) {