Silently create chat in get_message_sender_object.
This commit is contained in:
parent
d3a5025dae
commit
cdd7430d3a
@ -13604,15 +13604,8 @@ const DialogParticipant *ContactsManager::get_chat_full_participant(const ChatFu
|
||||
|
||||
tl_object_ptr<td_api::chatMember> ContactsManager::get_chat_member_object(const DialogParticipant &dialog_participant,
|
||||
const char *source) const {
|
||||
DialogId dialog_id = dialog_participant.dialog_id_;
|
||||
UserId participant_user_id;
|
||||
if (dialog_id.get_type() == DialogType::User) {
|
||||
participant_user_id = dialog_id.get_user_id();
|
||||
} else {
|
||||
td_->dialog_manager_->force_create_dialog(dialog_id, source, true);
|
||||
}
|
||||
return td_api::make_object<td_api::chatMember>(
|
||||
get_message_sender_object_const(td_, dialog_id, source),
|
||||
get_message_sender_object(td_, dialog_participant.dialog_id_, source),
|
||||
get_user_id_object(dialog_participant.inviter_user_id_, "chatMember.inviter_user_id"),
|
||||
dialog_participant.joined_date_, dialog_participant.status_.get_chat_member_status_object());
|
||||
}
|
||||
|
@ -28,8 +28,7 @@ ForumTopicInfo::ForumTopicInfo(Td *td, const tl_object_ptr<telegram_api::ForumTo
|
||||
icon_ = ForumTopicIcon(forum_topic->icon_color_, forum_topic->icon_emoji_id_);
|
||||
creation_date_ = forum_topic->date_;
|
||||
creator_dialog_id_ = DialogId(forum_topic->from_id_);
|
||||
if (creator_dialog_id_.is_valid() && creator_dialog_id_.get_type() != DialogType::User &&
|
||||
td->dialog_manager_->have_dialog_info_force(creator_dialog_id_, "ForumTopicInfo")) {
|
||||
if (creator_dialog_id_.is_valid() && creator_dialog_id_.get_type() != DialogType::User) {
|
||||
td->dialog_manager_->force_create_dialog(creator_dialog_id_, "ForumTopicInfo", true);
|
||||
}
|
||||
is_outgoing_ = forum_topic->my_;
|
||||
|
@ -43,8 +43,7 @@ td_api::object_ptr<td_api::MessageSender> get_message_sender_object_const(Td *td
|
||||
td_api::object_ptr<td_api::MessageSender> get_message_sender_object(Td *td, UserId user_id, DialogId dialog_id,
|
||||
const char *source) {
|
||||
if (dialog_id.is_valid() && !td->messages_manager_->have_dialog(dialog_id)) {
|
||||
LOG(ERROR) << "Failed to find " << dialog_id << " from " << source;
|
||||
td->dialog_manager_->force_create_dialog(dialog_id, source);
|
||||
td->dialog_manager_->force_create_dialog(dialog_id, source, true);
|
||||
}
|
||||
if (!user_id.is_valid() && td->auth_manager_->is_bot()) {
|
||||
td->contacts_manager_->add_anonymous_bot_user();
|
||||
|
@ -23806,7 +23806,7 @@ void MessagesManager::get_dialog_send_message_as_dialog_ids(
|
||||
auto senders = td_api::make_object<td_api::chatMessageSenders>();
|
||||
if (!created_public_broadcasts_.empty()) {
|
||||
auto add_sender = [&senders, td = td_](DialogId dialog_id, bool needs_premium) {
|
||||
auto sender = get_message_sender_object_const(td, dialog_id, "add_sender");
|
||||
auto sender = get_message_sender_object(td, dialog_id, "add_sender");
|
||||
senders->senders_.push_back(td_api::make_object<td_api::chatMessageSender>(std::move(sender), needs_premium));
|
||||
};
|
||||
if (td_->dialog_manager_->is_anonymous_administrator(dialog_id, nullptr)) {
|
||||
|
@ -89,10 +89,6 @@ StoryViewer::StoryViewer(Td *td, telegram_api::object_ptr<telegram_api::StoryRea
|
||||
if (!actor_dialog_id.is_valid() || story_reaction->date_ <= 0) {
|
||||
break;
|
||||
}
|
||||
if (actor_dialog_id.get_type() != DialogType::User) {
|
||||
td->dialog_manager_->force_create_dialog(actor_dialog_id, "StoryViewer", true);
|
||||
}
|
||||
|
||||
type_ = Type::View;
|
||||
actor_dialog_id_ = actor_dialog_id;
|
||||
date_ = story_reaction->date_;
|
||||
@ -160,8 +156,8 @@ td_api::object_ptr<td_api::storyInteraction> StoryViewer::get_story_interaction_
|
||||
}();
|
||||
auto block_list_id = BlockListId(is_blocked_, is_blocked_for_stories_);
|
||||
return td_api::make_object<td_api::storyInteraction>(
|
||||
get_message_sender_object_const(td, actor_dialog_id_, "storyInteraction"), date_,
|
||||
block_list_id.get_block_list_object(), std::move(type));
|
||||
get_message_sender_object(td, actor_dialog_id_, "storyInteraction"), date_, block_list_id.get_block_list_object(),
|
||||
std::move(type));
|
||||
}
|
||||
|
||||
bool StoryViewer::is_valid() const {
|
||||
|
Loading…
Reference in New Issue
Block a user