Disallow creation of an empty folder and a copy of the main chat list.

GitOrigin-RevId: 4a76401374821085fca0776ecabefd4fcc6f057f
This commit is contained in:
levlam 2020-05-27 20:52:59 +03:00
parent 7ae25bc255
commit 4ace9f4c02

View File

@ -15318,6 +15318,18 @@ Status MessagesManager::check_dialog_filter_limits(const DialogFilter *dialog_fi
return Status::Error(400, "Maximum number of pinned chats exceeded");
}
if (dialog_filter->pinned_dialog_ids.empty() && dialog_filter->included_dialog_ids.empty() &&
!dialog_filter->include_contacts && !dialog_filter->include_non_contacts && !dialog_filter->include_bots &&
!dialog_filter->include_groups && !dialog_filter->include_channels) {
return Status::Error(400, "Folder must contain at least 1 chat");
}
if (dialog_filter->include_contacts && dialog_filter->include_non_contacts && dialog_filter->include_bots &&
dialog_filter->include_groups && dialog_filter->include_channels && dialog_filter->exclude_archived &&
!dialog_filter->exclude_read && !dialog_filter->exclude_muted) {
return Status::Error(400, "Folder must be different from the main chat list");
}
return Status::OK();
}