Fix can_delete flags in updateNewChat.
GitOrigin-RevId: 715cca8966860c61b444fbe5ee83aaf884f3af4c
This commit is contained in:
parent
8ffc211e43
commit
ea9caab8bc
@ -15567,11 +15567,15 @@ 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) const {
|
||||
td_api::object_ptr<td_api::chat> MessagesManager::get_chat_object(const Dialog *d, int64 real_order) 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) {
|
||||
@ -15584,7 +15588,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() && d->order != DEFAULT_ORDER) {
|
||||
} else if (!td_->auth_manager_->is_bot() && real_order != DEFAULT_ORDER) {
|
||||
switch (d->dialog_id.get_type()) {
|
||||
case DialogType::User:
|
||||
can_delete_for_self = true;
|
||||
@ -22920,10 +22924,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) {
|
||||
void MessagesManager::send_update_new_chat(Dialog *d, int64 real_order) {
|
||||
CHECK(d != nullptr);
|
||||
CHECK(d->messages == nullptr);
|
||||
auto chat_object = get_chat_object(d);
|
||||
auto chat_object = get_chat_object(d, real_order);
|
||||
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)));
|
||||
@ -28064,7 +28068,7 @@ MessagesManager::Dialog *MessagesManager::add_new_dialog(unique_ptr<Dialog> &&d,
|
||||
|
||||
fix_dialog_action_bar(dialog);
|
||||
|
||||
send_update_new_chat(dialog);
|
||||
send_update_new_chat(dialog, order);
|
||||
|
||||
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);
|
||||
|
@ -1910,7 +1910,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);
|
||||
void send_update_new_chat(Dialog *d, int64 real_order);
|
||||
|
||||
void send_update_chat_draft_message(const Dialog *d);
|
||||
|
||||
@ -2092,7 +2092,7 @@ class MessagesManager : public Actor {
|
||||
|
||||
td_api::object_ptr<td_api::ChatActionBar> get_chat_action_bar_object(const Dialog *d) const;
|
||||
|
||||
td_api::object_ptr<td_api::chat> get_chat_object(const Dialog *d) const;
|
||||
td_api::object_ptr<td_api::chat> get_chat_object(const Dialog *d, int64 real_order = DEFAULT_ORDER) 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