Add DialogFilter::can_have_archived_dialogs.
This commit is contained in:
parent
dc18ce7b0e
commit
d0593a02c1
@ -574,12 +574,16 @@ void DialogFilter::sort_input_dialog_ids(const Td *td, const char *source) {
|
||||
}
|
||||
|
||||
vector<FolderId> DialogFilter::get_folder_ids() const {
|
||||
if (exclude_archived && pinned_dialog_ids.empty() && included_dialog_ids.empty()) {
|
||||
if (!can_have_archived_dialogs()) {
|
||||
return {FolderId::main()};
|
||||
}
|
||||
return {FolderId::main(), FolderId::archive()};
|
||||
}
|
||||
|
||||
bool DialogFilter::can_have_archived_dialogs() const {
|
||||
return !(exclude_archived && pinned_dialog_ids.empty() && included_dialog_ids.empty());
|
||||
}
|
||||
|
||||
bool DialogFilter::need_dialog(const Td *td, DialogId dialog_id, bool has_unread_mentions, bool is_muted,
|
||||
bool has_unread_messages, FolderId folder_id) const {
|
||||
if (is_dialog_included(dialog_id)) {
|
||||
|
@ -99,6 +99,8 @@ class DialogFilter {
|
||||
|
||||
vector<FolderId> get_folder_ids() const;
|
||||
|
||||
bool can_have_archived_dialogs() const;
|
||||
|
||||
bool need_dialog(const Td *td, DialogId dialog_id, bool has_unread_mentions, bool is_muted, bool has_unread_messages,
|
||||
FolderId folder_id) const;
|
||||
|
||||
|
@ -39034,8 +39034,7 @@ bool MessagesManager::has_dialogs_from_folder(const DialogList &list, const Dial
|
||||
auto dialog_filter_id = list.dialog_list_id.get_filter_id();
|
||||
auto *dialog_filter = get_dialog_filter(dialog_filter_id);
|
||||
CHECK(dialog_filter != nullptr);
|
||||
if (dialog_filter->exclude_archived && dialog_filter->pinned_dialog_ids.empty() &&
|
||||
dialog_filter->included_dialog_ids.empty()) {
|
||||
if (!dialog_filter->can_have_archived_dialogs()) {
|
||||
return folder.folder_id == FolderId::main();
|
||||
}
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user