Add MessagesManager::is_removed_from_dialog_list.
GitOrigin-RevId: a0d49b0a9c945110b6a7365489795c2fb9b73126
This commit is contained in:
parent
f14b83f367
commit
33b87d1b13
@ -28143,40 +28143,31 @@ int64 MessagesManager::get_next_pinned_dialog_order() {
|
|||||||
return current_pinned_dialog_order_;
|
return current_pinned_dialog_order_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessagesManager::update_dialog_pos(Dialog *d, const char *source, bool need_send_update_chat_order,
|
bool MessagesManager::is_removed_from_dialog_list(const Dialog *d) const {
|
||||||
bool is_loaded_from_database) {
|
switch (d->dialog_id.get_type()) {
|
||||||
CHECK(d != nullptr);
|
|
||||||
LOG(INFO) << "Trying to update " << d->dialog_id << " order from " << source;
|
|
||||||
auto dialog_type = d->dialog_id.get_type();
|
|
||||||
|
|
||||||
bool remove_from_dialog_list = false;
|
|
||||||
switch (dialog_type) {
|
|
||||||
case DialogType::User:
|
case DialogType::User:
|
||||||
break;
|
break;
|
||||||
case DialogType::Chat: {
|
case DialogType::Chat:
|
||||||
auto chat_id = d->dialog_id.get_chat_id();
|
return !td_->contacts_manager_->get_chat_is_active(d->dialog_id.get_chat_id());
|
||||||
if (!td_->contacts_manager_->get_chat_is_active(chat_id)) {
|
case DialogType::Channel:
|
||||||
remove_from_dialog_list = true;
|
return !td_->contacts_manager_->get_channel_status(d->dialog_id.get_channel_id()).is_member();
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case DialogType::Channel: {
|
|
||||||
auto channel_id = d->dialog_id.get_channel_id();
|
|
||||||
if (!td_->contacts_manager_->get_channel_status(channel_id).is_member()) {
|
|
||||||
remove_from_dialog_list = true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case DialogType::SecretChat:
|
case DialogType::SecretChat:
|
||||||
break;
|
break;
|
||||||
case DialogType::None:
|
case DialogType::None:
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MessagesManager::update_dialog_pos(Dialog *d, const char *source, bool need_send_update_chat_order,
|
||||||
|
bool is_loaded_from_database) {
|
||||||
|
CHECK(d != nullptr);
|
||||||
|
LOG(INFO) << "Trying to update " << d->dialog_id << " order from " << source;
|
||||||
|
|
||||||
int64 new_order = DEFAULT_ORDER;
|
int64 new_order = DEFAULT_ORDER;
|
||||||
if (!remove_from_dialog_list) {
|
if (!is_removed_from_dialog_list(d)) {
|
||||||
if (d->pinned_order != DEFAULT_ORDER) {
|
if (d->pinned_order != DEFAULT_ORDER) {
|
||||||
LOG(INFO) << "Pin at " << d->pinned_order << " found";
|
LOG(INFO) << "Pin at " << d->pinned_order << " found";
|
||||||
new_order = d->pinned_order;
|
new_order = d->pinned_order;
|
||||||
@ -28216,6 +28207,7 @@ void MessagesManager::update_dialog_pos(Dialog *d, const char *source, bool need
|
|||||||
new_order = draft_order;
|
new_order = draft_order;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
auto dialog_type = d->dialog_id.get_type();
|
||||||
if (dialog_type == DialogType::Channel) {
|
if (dialog_type == DialogType::Channel) {
|
||||||
auto date = td_->contacts_manager_->get_channel_date(d->dialog_id.get_channel_id());
|
auto date = td_->contacts_manager_->get_channel_date(d->dialog_id.get_channel_id());
|
||||||
LOG(INFO) << "Join of channel at " << date << " found";
|
LOG(INFO) << "Join of channel at " << date << " found";
|
||||||
|
@ -2284,6 +2284,8 @@ class MessagesManager : public Actor {
|
|||||||
|
|
||||||
int64 get_next_pinned_dialog_order();
|
int64 get_next_pinned_dialog_order();
|
||||||
|
|
||||||
|
bool is_removed_from_dialog_list(const Dialog *d) const;
|
||||||
|
|
||||||
void update_dialog_pos(Dialog *d, const char *source, bool need_send_update_chat_order = true,
|
void update_dialog_pos(Dialog *d, const char *source, bool need_send_update_chat_order = true,
|
||||||
bool is_loaded_from_database = false);
|
bool is_loaded_from_database = false);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user