Add DialogFilter::is_dialog_pinned.

This commit is contained in:
levlam 2023-03-22 23:05:13 +03:00
parent d0593a02c1
commit 7871a4192a
3 changed files with 8 additions and 5 deletions

View File

@ -172,9 +172,12 @@ bool DialogFilter::is_empty(bool for_server) const {
} }
} }
bool DialogFilter::is_dialog_pinned(DialogId dialog_id) const {
return InputDialogId::contains(pinned_dialog_ids, dialog_id);
}
bool DialogFilter::is_dialog_included(DialogId dialog_id) const { bool DialogFilter::is_dialog_included(DialogId dialog_id) const {
return InputDialogId::contains(included_dialog_ids, dialog_id) || return InputDialogId::contains(included_dialog_ids, dialog_id) || is_dialog_pinned(dialog_id);
InputDialogId::contains(pinned_dialog_ids, dialog_id);
} }
bool DialogFilter::can_include_dialog(DialogId dialog_id) const { bool DialogFilter::can_include_dialog(DialogId dialog_id) const {

View File

@ -70,6 +70,8 @@ class DialogFilter {
return dialog_filter_id; return dialog_filter_id;
} }
bool is_dialog_pinned(DialogId dialog_id) const;
bool is_dialog_included(DialogId dialog_id) const; bool is_dialog_included(DialogId dialog_id) const;
bool can_include_dialog(DialogId dialog_id) const; bool can_include_dialog(DialogId dialog_id) const;

View File

@ -15430,9 +15430,7 @@ bool MessagesManager::is_dialog_pinned(DialogListId dialog_list_id, DialogId dia
} }
if (dialog_list_id.is_filter()) { if (dialog_list_id.is_filter()) {
const auto *dialog_filter = get_dialog_filter(dialog_list_id.get_filter_id()); const auto *dialog_filter = get_dialog_filter(dialog_list_id.get_filter_id());
if (dialog_filter != nullptr && InputDialogId::contains(dialog_filter->pinned_dialog_ids, dialog_id)) { return dialog_filter != nullptr && dialog_filter->is_dialog_pinned(dialog_id);
return true;
}
} }
return false; return false;
} }