Keep in chat list empty joined basic groups.
This commit is contained in:
parent
1302aa2520
commit
161d34fc15
@ -14646,6 +14646,14 @@ void ContactsManager::send_get_chat_full_query(ChatId chat_id, Promise<Unit> &&p
|
||||
get_chat_full_queries_.add_query(DialogId(chat_id).get(), std::move(send_query), std::move(promise));
|
||||
}
|
||||
|
||||
int32 ContactsManager::get_chat_date(ChatId chat_id) const {
|
||||
auto c = get_chat(chat_id);
|
||||
if (c == nullptr) {
|
||||
return 0;
|
||||
}
|
||||
return c->date;
|
||||
}
|
||||
|
||||
int32 ContactsManager::get_chat_participant_count(ChatId chat_id) const {
|
||||
auto c = get_chat(chat_id);
|
||||
if (c == nullptr) {
|
||||
|
@ -496,6 +496,7 @@ class ContactsManager final : public Actor {
|
||||
FileSourceId get_chat_full_file_source_id(ChatId chat_id);
|
||||
void reload_chat_full(ChatId chat_id, Promise<Unit> &&promise);
|
||||
|
||||
int32 get_chat_date(ChatId chat_id) const;
|
||||
int32 get_chat_participant_count(ChatId chat_id) const;
|
||||
bool get_chat_is_active(ChatId chat_id) const;
|
||||
ChannelId get_chat_migrated_to_channel_id(ChatId chat_id) const;
|
||||
|
@ -37139,24 +37139,39 @@ void MessagesManager::update_dialog_pos(Dialog *d, const char *source, bool need
|
||||
new_order = draft_order;
|
||||
}
|
||||
}
|
||||
auto dialog_type = d->dialog_id.get_type();
|
||||
if (dialog_type == DialogType::Channel) {
|
||||
switch (d->dialog_id.get_type()) {
|
||||
case DialogType::Chat: {
|
||||
auto chat_id = d->dialog_id.get_chat_id();
|
||||
auto date = td_->contacts_manager_->get_chat_date(chat_id);
|
||||
LOG(INFO) << "Creation at " << date << " found";
|
||||
int64 join_order = get_dialog_order(MessageId(), date);
|
||||
if (join_order > new_order && td_->contacts_manager_->get_chat_status(chat_id).is_member()) {
|
||||
new_order = join_order;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DialogType::Channel: {
|
||||
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 at " << date << " found";
|
||||
int64 join_order = get_dialog_order(MessageId(), date);
|
||||
if (join_order > new_order) {
|
||||
new_order = join_order;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (dialog_type == DialogType::SecretChat) {
|
||||
case DialogType::SecretChat: {
|
||||
auto date = td_->contacts_manager_->get_secret_chat_date(d->dialog_id.get_secret_chat_id());
|
||||
if (date != 0 && !is_deleted_secret_chat(d)) {
|
||||
LOG(INFO) << "Creation of secret chat at " << date << " found";
|
||||
LOG(INFO) << "Creation at " << date << " found";
|
||||
int64 creation_order = get_dialog_order(MessageId(), date);
|
||||
if (creation_order > new_order) {
|
||||
new_order = creation_order;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (new_order == DEFAULT_ORDER && !d->is_empty) {
|
||||
LOG(INFO) << "There are no known messages in the chat, just leave it where it is";
|
||||
|
Loading…
Reference in New Issue
Block a user