Merge remote-tracking branch 'td/master'
This commit is contained in:
commit
388c9e6cdd
@ -115,7 +115,8 @@ Result<DialogId> get_message_sender_dialog_id(Td *td,
|
||||
}
|
||||
return Status::Error(400, "Invalid user identifier specified");
|
||||
}
|
||||
if (check_access && !td->contacts_manager_->have_user_force(user_id)) {
|
||||
bool know_user = td->contacts_manager_->have_user_force(user_id);
|
||||
if (check_access && !know_user) {
|
||||
return Status::Error(400, "Unknown user identifier specified");
|
||||
}
|
||||
return DialogId(user_id);
|
||||
@ -128,12 +129,11 @@ Result<DialogId> get_message_sender_dialog_id(Td *td,
|
||||
}
|
||||
return Status::Error(400, "Invalid chat identifier specified");
|
||||
}
|
||||
if (check_access) {
|
||||
bool is_user = dialog_id.get_type() == DialogType::User;
|
||||
if (is_user ? !td->contacts_manager_->have_user_force(dialog_id.get_user_id())
|
||||
: !td->messages_manager_->have_dialog_force(dialog_id, "get_message_sender_dialog_id")) {
|
||||
return Status::Error(400, "Unknown chat identifier specified");
|
||||
}
|
||||
bool know_dialog = dialog_id.get_type() == DialogType::User
|
||||
? td->contacts_manager_->have_user_force(dialog_id.get_user_id())
|
||||
: td->messages_manager_->have_dialog_force(dialog_id, "get_message_sender_dialog_id");
|
||||
if (check_access && !know_dialog) {
|
||||
return Status::Error(400, "Unknown chat identifier specified");
|
||||
}
|
||||
return dialog_id;
|
||||
}
|
||||
|
@ -5305,7 +5305,8 @@ void MessagesManager::Dialog::store(StorerT &storer) const {
|
||||
bool has_flags3 = true;
|
||||
bool has_pending_join_requests = pending_join_request_count != 0;
|
||||
bool has_action_bar = action_bar != nullptr;
|
||||
bool has_default_send_message_as_dialog_id = default_send_message_as_dialog_id.is_valid();
|
||||
bool has_default_send_message_as_dialog_id =
|
||||
default_send_message_as_dialog_id.is_valid() && !need_drop_default_send_message_as_dialog_id;
|
||||
BEGIN_STORE_FLAGS();
|
||||
STORE_FLAG(has_draft_message);
|
||||
STORE_FLAG(has_last_database_message);
|
||||
@ -20193,6 +20194,13 @@ void MessagesManager::open_dialog(Dialog *d) {
|
||||
if (d->active_group_call_id.is_valid()) {
|
||||
td_->group_call_manager_->reload_group_call(d->active_group_call_id, Auto());
|
||||
}
|
||||
if (d->need_drop_default_send_message_as_dialog_id) {
|
||||
CHECK(d->default_send_message_as_dialog_id.is_valid());
|
||||
d->need_drop_default_send_message_as_dialog_id = false;
|
||||
d->default_send_message_as_dialog_id = DialogId();
|
||||
LOG(INFO) << "Set default message sender in " << d->dialog_id << " to " << d->default_send_message_as_dialog_id;
|
||||
send_update_chat_default_message_sender_id(d);
|
||||
}
|
||||
|
||||
switch (dialog_id.get_type()) {
|
||||
case DialogType::User:
|
||||
@ -31083,9 +31091,18 @@ void MessagesManager::on_update_dialog_default_send_message_as_dialog_id(DialogI
|
||||
}
|
||||
|
||||
if (d->default_send_message_as_dialog_id != default_send_as_dialog_id) {
|
||||
LOG(INFO) << "Set default message sender in " << dialog_id << " to " << default_send_as_dialog_id;
|
||||
d->default_send_message_as_dialog_id = default_send_as_dialog_id;
|
||||
send_update_chat_default_message_sender_id(d);
|
||||
if (force || default_send_as_dialog_id.is_valid() || created_public_broadcasts_.empty()) {
|
||||
LOG(INFO) << "Set default message sender in " << dialog_id << " to " << default_send_as_dialog_id;
|
||||
d->need_drop_default_send_message_as_dialog_id = false;
|
||||
d->default_send_message_as_dialog_id = default_send_as_dialog_id;
|
||||
send_update_chat_default_message_sender_id(d);
|
||||
} else {
|
||||
d->need_drop_default_send_message_as_dialog_id = true;
|
||||
on_dialog_updated(d->dialog_id, "on_update_dialog_default_send_message_as_dialog_id");
|
||||
}
|
||||
} else if (default_send_as_dialog_id.is_valid() && d->need_drop_default_send_message_as_dialog_id) {
|
||||
d->need_drop_default_send_message_as_dialog_id = false;
|
||||
on_dialog_updated(d->dialog_id, "on_update_dialog_default_send_message_as_dialog_id");
|
||||
}
|
||||
}
|
||||
|
||||
@ -34967,6 +34984,7 @@ MessagesManager::Dialog *MessagesManager::add_new_dialog(unique_ptr<Dialog> &&d,
|
||||
if (default_send_message_as_dialog_id != dialog_id &&
|
||||
default_send_message_as_dialog_id.get_type() != DialogType::User &&
|
||||
!have_dialog(default_send_message_as_dialog_id)) {
|
||||
d->need_drop_default_send_message_as_dialog_id = false;
|
||||
d->default_send_message_as_dialog_id = DialogId();
|
||||
}
|
||||
|
||||
|
@ -1266,6 +1266,7 @@ class MessagesManager final : public Actor {
|
||||
bool was_opened = false;
|
||||
|
||||
bool need_restore_reply_markup = true;
|
||||
bool need_drop_default_send_message_as_dialog_id = false;
|
||||
|
||||
bool have_full_history = false;
|
||||
bool is_empty = false;
|
||||
|
Loading…
Reference in New Issue
Block a user