Move remove_secret_chat_dialog_ids to DialogId.
This commit is contained in:
parent
c0a0f7de07
commit
57f1b32617
@ -179,4 +179,9 @@ vector<DialogId> DialogId::get_dialog_ids(const vector<int64> &chat_ids) {
|
||||
return transform(chat_ids, [](int64 chat_id) { return DialogId(chat_id); });
|
||||
}
|
||||
|
||||
vector<DialogId> DialogId::remove_secret_chat_dialog_ids(vector<DialogId> dialog_ids) {
|
||||
td::remove_if(dialog_ids, [](DialogId dialog_id) { return dialog_id.get_type() == DialogType::SecretChat; });
|
||||
return dialog_ids;
|
||||
}
|
||||
|
||||
} // namespace td
|
||||
|
@ -72,6 +72,8 @@ class DialogId {
|
||||
|
||||
static vector<DialogId> get_dialog_ids(const vector<int64> &chat_ids);
|
||||
|
||||
static vector<DialogId> remove_secret_chat_dialog_ids(vector<DialogId> dialog_ids);
|
||||
|
||||
template <class StorerT>
|
||||
void store(StorerT &storer) const {
|
||||
storer.store_long(id);
|
||||
|
@ -15613,7 +15613,7 @@ void MessagesManager::on_get_dialogs(FolderId folder_id, vector<tl_object_ptr<te
|
||||
CHECK(!td_->auth_manager_->is_bot());
|
||||
auto *folder_list = get_dialog_list(DialogListId(folder_id));
|
||||
CHECK(folder_list != nullptr);
|
||||
auto pinned_dialog_ids = remove_secret_chat_dialog_ids(get_pinned_dialog_ids(DialogListId(folder_id)));
|
||||
auto pinned_dialog_ids = DialogId::remove_secret_chat_dialog_ids(get_pinned_dialog_ids(DialogListId(folder_id)));
|
||||
bool are_pinned_dialogs_saved = folder_list->are_pinned_dialogs_inited_;
|
||||
folder_list->are_pinned_dialogs_inited_ = true;
|
||||
if (pinned_dialog_ids != added_dialog_ids) {
|
||||
@ -18569,11 +18569,6 @@ int32 MessagesManager::get_pinned_dialogs_limit(DialogListId dialog_list_id) con
|
||||
return limit;
|
||||
}
|
||||
|
||||
vector<DialogId> MessagesManager::remove_secret_chat_dialog_ids(vector<DialogId> dialog_ids) {
|
||||
td::remove_if(dialog_ids, [](DialogId dialog_id) { return dialog_id.get_type() == DialogType::SecretChat; });
|
||||
return dialog_ids;
|
||||
}
|
||||
|
||||
Status MessagesManager::toggle_dialog_is_pinned(DialogListId dialog_list_id, DialogId dialog_id, bool is_pinned) {
|
||||
if (td_->auth_manager_->is_bot()) {
|
||||
return Status::Error(400, "Bots can't change chat pin state");
|
||||
@ -18732,8 +18727,8 @@ Status MessagesManager::set_pinned_dialogs(DialogListId dialog_list_id, vector<D
|
||||
}
|
||||
LOG(INFO) << "Reorder pinned chats in " << dialog_list_id << " from " << pinned_dialog_ids << " to " << dialog_ids;
|
||||
|
||||
auto server_old_dialog_ids = remove_secret_chat_dialog_ids(pinned_dialog_ids);
|
||||
auto server_new_dialog_ids = remove_secret_chat_dialog_ids(dialog_ids);
|
||||
auto server_old_dialog_ids = DialogId::remove_secret_chat_dialog_ids(pinned_dialog_ids);
|
||||
auto server_new_dialog_ids = DialogId::remove_secret_chat_dialog_ids(dialog_ids);
|
||||
|
||||
if (dialog_list_id.is_filter()) {
|
||||
return td_->dialog_filter_manager_->set_pinned_dialog_ids(
|
||||
|
@ -2503,8 +2503,6 @@ class MessagesManager final : public Actor {
|
||||
|
||||
int32 get_pinned_dialogs_limit(DialogListId dialog_list_id) const;
|
||||
|
||||
static vector<DialogId> remove_secret_chat_dialog_ids(vector<DialogId> dialog_ids);
|
||||
|
||||
bool set_dialog_is_pinned(DialogId dialog_id, bool is_pinned);
|
||||
|
||||
bool set_dialog_is_pinned(DialogListId dialog_list_id, Dialog *d, bool is_pinned,
|
||||
|
Loading…
x
Reference in New Issue
Block a user