Rename hide_distance to has_outgoing_messages.

This commit is contained in:
levlam 2021-11-23 12:10:49 +03:00
parent 46b8aeab97
commit 0e96d23e41
2 changed files with 17 additions and 17 deletions

View File

@ -5230,7 +5230,7 @@ void MessagesManager::Dialog::store(StorerT &storer) const {
STORE_FLAG(need_repair_channel_server_unread_count);
STORE_FLAG(false); // action_bar->can_unarchive
STORE_FLAG(false); // action_bar_has_distance
STORE_FLAG(hide_distance);
STORE_FLAG(has_outgoing_messages);
STORE_FLAG(has_last_yet_unsent_message);
STORE_FLAG(is_blocked);
STORE_FLAG(is_is_blocked_inited);
@ -5448,7 +5448,7 @@ void MessagesManager::Dialog::parse(ParserT &parser) {
PARSE_FLAG(need_repair_channel_server_unread_count);
PARSE_FLAG(action_bar_can_unarchive);
PARSE_FLAG(action_bar_has_distance);
PARSE_FLAG(hide_distance);
PARSE_FLAG(has_outgoing_messages);
PARSE_FLAG(had_last_yet_unsent_message);
PARSE_FLAG(is_blocked);
PARSE_FLAG(is_is_blocked_inited);
@ -5470,7 +5470,7 @@ void MessagesManager::Dialog::parse(ParserT &parser) {
has_scheduled_server_messages = false;
has_scheduled_database_messages = false;
need_repair_channel_server_unread_count = false;
hide_distance = false;
has_outgoing_messages = false;
had_last_yet_unsent_message = false;
is_blocked = false;
is_is_blocked_inited = false;
@ -5628,10 +5628,10 @@ void MessagesManager::Dialog::parse(ParserT &parser) {
(void)legacy_know_can_report_spam;
if (know_action_bar && !has_action_bar) {
action_bar = DialogActionBar::create(action_bar_can_report_spam, action_bar_can_add_contact,
action_bar_can_block_user, action_bar_can_share_phone_number,
action_bar_can_report_location, action_bar_can_unarchive,
hide_distance ? -1 : action_bar_distance, action_bar_can_invite_members);
action_bar = DialogActionBar::create(
action_bar_can_report_spam, action_bar_can_add_contact, action_bar_can_block_user,
action_bar_can_share_phone_number, action_bar_can_report_location, action_bar_can_unarchive,
has_outgoing_messages ? -1 : action_bar_distance, action_bar_can_invite_members);
}
}
@ -8232,7 +8232,7 @@ void MessagesManager::on_get_peer_settings(DialogId dialog_id,
auto distance =
(peer_settings->flags_ & telegram_api::peerSettings::GEO_DISTANCE_MASK) != 0 ? peer_settings->geo_distance_ : -1;
if (distance < -1 || d->hide_distance) {
if (distance < -1 || d->has_outgoing_messages) {
distance = -1;
}
auto action_bar =
@ -32870,7 +32870,7 @@ MessagesManager::Message *MessagesManager::add_message_to_dialog(Dialog *d, uniq
update_used_hashtags(dialog_id, m);
update_top_dialogs(dialog_id, m);
cancel_user_dialog_action(dialog_id, m);
try_hide_distance(dialog_id, m);
update_has_outgoing_messages(dialog_id, m);
if (!td_->auth_manager_->is_bot() && d->messages == nullptr && !m->is_outgoing && dialog_id != get_my_dialog_id()) {
switch (dialog_type) {
@ -33082,7 +33082,7 @@ MessagesManager::Message *MessagesManager::add_scheduled_message_to_dialog(Dialo
if (from_update) {
update_sent_message_contents(dialog_id, m);
update_used_hashtags(dialog_id, m);
try_hide_distance(dialog_id, m);
update_has_outgoing_messages(dialog_id, m);
}
if (m->message_id.is_scheduled_server()) {
@ -36692,7 +36692,7 @@ void MessagesManager::update_forward_count(DialogId dialog_id, MessageId message
}
}
void MessagesManager::try_hide_distance(DialogId dialog_id, const Message *m) {
void MessagesManager::update_has_outgoing_messages(DialogId dialog_id, const Message *m) {
CHECK(m != nullptr);
if (td_->auth_manager_->is_bot() || (!m->is_outgoing && dialog_id != get_my_dialog_id())) {
return;
@ -36709,19 +36709,19 @@ void MessagesManager::try_hide_distance(DialogId dialog_id, const Message *m) {
case DialogType::SecretChat: {
auto user_id = td_->contacts_manager_->get_secret_chat_user_id(dialog_id.get_secret_chat_id());
if (user_id.is_valid()) {
d = get_dialog_force(DialogId(user_id), "try_hide_distance");
d = get_dialog_force(DialogId(user_id), "update_has_outgoing_messages");
}
break;
}
default:
UNREACHABLE();
}
if (d == nullptr || d->hide_distance) {
if (d == nullptr || d->has_outgoing_messages) {
return;
}
d->hide_distance = true;
on_dialog_updated(dialog_id, "try_hide_distance");
d->has_outgoing_messages = true;
on_dialog_updated(dialog_id, "update_has_outgoing_messages");
if (d->action_bar != nullptr && d->action_bar->on_outgoing_message()) {
send_update_chat_action_bar(d);

View File

@ -1232,7 +1232,7 @@ class MessagesManager final : public Actor {
bool need_repair_action_bar = false;
bool know_action_bar = false;
bool hide_distance = false;
bool has_outgoing_messages = false;
bool is_opened = false;
bool was_opened = false;
@ -3052,7 +3052,7 @@ class MessagesManager final : public Actor {
void update_forward_count(DialogId dialog_id, MessageId message_id, int32 update_date);
void try_hide_distance(DialogId dialog_id, const Message *m);
void update_has_outgoing_messages(DialogId dialog_id, const Message *m);
string get_message_search_text(const Message *m) const;