Fix MessagesManager::get_chat_object.
GitOrigin-RevId: a5dddba5f844b8064fe7083c8532f9d2286b9dba
This commit is contained in:
parent
99163ff431
commit
c916566e76
@ -18848,15 +18848,11 @@ td_api::object_ptr<td_api::ChatActionBar> MessagesManager::get_chat_action_bar_o
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
td_api::object_ptr<td_api::chat> MessagesManager::get_chat_object(const Dialog *d, int64 real_order) const {
|
||||
td_api::object_ptr<td_api::chat> MessagesManager::get_chat_object(const Dialog *d) const {
|
||||
CHECK(d != nullptr);
|
||||
|
||||
auto chat_source = is_dialog_sponsored(d) ? sponsored_dialog_source_.get_chat_source_object() : nullptr;
|
||||
|
||||
if (real_order == DEFAULT_ORDER) {
|
||||
real_order = d->order;
|
||||
}
|
||||
|
||||
bool can_delete_for_self = false;
|
||||
bool can_delete_for_all_users = false;
|
||||
if (chat_source != nullptr) {
|
||||
@ -18869,7 +18865,7 @@ td_api::object_ptr<td_api::chat> MessagesManager::get_chat_object(const Dialog *
|
||||
// can't delete
|
||||
break;
|
||||
}
|
||||
} else if (!td_->auth_manager_->is_bot() && real_order != DEFAULT_ORDER) {
|
||||
} else if (!td_->auth_manager_->is_bot() && have_input_peer(d->dialog_id, AccessRights::Read)) {
|
||||
switch (d->dialog_id.get_type()) {
|
||||
case DialogType::User:
|
||||
can_delete_for_self = true;
|
||||
@ -26891,10 +26887,10 @@ void MessagesManager::send_update_delete_messages(DialogId dialog_id, vector<int
|
||||
make_tl_object<td_api::updateDeleteMessages>(dialog_id.get(), std::move(message_ids), is_permanent, from_cache));
|
||||
}
|
||||
|
||||
void MessagesManager::send_update_new_chat(Dialog *d, int64 real_order) {
|
||||
void MessagesManager::send_update_new_chat(Dialog *d) {
|
||||
CHECK(d != nullptr);
|
||||
CHECK(d->messages == nullptr);
|
||||
auto chat_object = get_chat_object(d, real_order);
|
||||
auto chat_object = get_chat_object(d);
|
||||
bool has_action_bar = chat_object->action_bar_ != nullptr;
|
||||
d->last_sent_has_scheduled_messages = chat_object->has_scheduled_messages_;
|
||||
send_closure(G()->td(), &Td::send_update, make_tl_object<td_api::updateNewChat>(std::move(chat_object)));
|
||||
@ -32339,7 +32335,7 @@ MessagesManager::Dialog *MessagesManager::add_new_dialog(unique_ptr<Dialog> &&d,
|
||||
|
||||
fix_dialog_action_bar(dialog);
|
||||
|
||||
send_update_new_chat(dialog, order);
|
||||
send_update_new_chat(dialog);
|
||||
|
||||
fix_new_dialog(dialog, std::move(last_database_message), last_database_message_id, order, last_clear_history_date,
|
||||
last_clear_history_message_id, is_loaded_from_database);
|
||||
|
@ -2187,7 +2187,7 @@ class MessagesManager : public Actor {
|
||||
void send_update_delete_messages(DialogId dialog_id, vector<int64> &&message_ids, bool is_permanent,
|
||||
bool from_cache) const;
|
||||
|
||||
void send_update_new_chat(Dialog *d, int64 real_order);
|
||||
void send_update_new_chat(Dialog *d);
|
||||
|
||||
void send_update_chat_draft_message(const Dialog *d);
|
||||
|
||||
@ -2388,7 +2388,7 @@ class MessagesManager : public Actor {
|
||||
td_api::object_ptr<td_api::ChatActionBar> get_chat_action_bar_object(const Dialog *d,
|
||||
bool hide_unarchive = false) const;
|
||||
|
||||
td_api::object_ptr<td_api::chat> get_chat_object(const Dialog *d, int64 real_order = DEFAULT_ORDER) const;
|
||||
td_api::object_ptr<td_api::chat> get_chat_object(const Dialog *d) const;
|
||||
|
||||
bool have_dialog_info(DialogId dialog_id) const;
|
||||
bool have_dialog_info_force(DialogId dialog_id) const;
|
||||
|
Loading…
Reference in New Issue
Block a user