Fix migrated_to_channel preloading.
GitOrigin-RevId: d87246857b4a6e7d429e8e9dd835ca0678f44a2d
This commit is contained in:
parent
a9ed429205
commit
5cecb37e8b
@ -4937,6 +4937,10 @@ bool ContactsManager::have_user_force(UserId user_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ContactsManager::User *ContactsManager::get_user_force(UserId user_id) {
|
ContactsManager::User *ContactsManager::get_user_force(UserId user_id) {
|
||||||
|
if (!user_id.is_valid()) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
User *u = get_user(user_id);
|
User *u = get_user(user_id);
|
||||||
if (u != nullptr) {
|
if (u != nullptr) {
|
||||||
return u;
|
return u;
|
||||||
@ -5138,6 +5142,10 @@ void ContactsManager::on_load_chat_from_database(ChatId chat_id, string value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (c != nullptr && c->migrated_to_channel_id.is_valid() && !have_channel_force(c->migrated_to_channel_id)) {
|
||||||
|
LOG(ERROR) << "Can't find " << c->migrated_to_channel_id << " from " << chat_id;
|
||||||
|
}
|
||||||
|
|
||||||
for (auto &promise : promises) {
|
for (auto &promise : promises) {
|
||||||
promise.set_value(Unit());
|
promise.set_value(Unit());
|
||||||
}
|
}
|
||||||
@ -5148,8 +5156,16 @@ bool ContactsManager::have_chat_force(ChatId chat_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ContactsManager::Chat *ContactsManager::get_chat_force(ChatId chat_id) {
|
ContactsManager::Chat *ContactsManager::get_chat_force(ChatId chat_id) {
|
||||||
|
if (!chat_id.is_valid()) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
Chat *c = get_chat(chat_id);
|
Chat *c = get_chat(chat_id);
|
||||||
if (c != nullptr) {
|
if (c != nullptr) {
|
||||||
|
if (c->migrated_to_channel_id.is_valid() && !have_channel_force(c->migrated_to_channel_id)) {
|
||||||
|
LOG(ERROR) << "Can't find " << c->migrated_to_channel_id << " from " << chat_id;
|
||||||
|
}
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
if (!G()->parameters().use_chat_info_db) {
|
if (!G()->parameters().use_chat_info_db) {
|
||||||
@ -5360,6 +5376,10 @@ bool ContactsManager::have_channel_force(ChannelId channel_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ContactsManager::Channel *ContactsManager::get_channel_force(ChannelId channel_id) {
|
ContactsManager::Channel *ContactsManager::get_channel_force(ChannelId channel_id) {
|
||||||
|
if (!channel_id.is_valid()) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
Channel *c = get_channel(channel_id);
|
Channel *c = get_channel(channel_id);
|
||||||
if (c != nullptr) {
|
if (c != nullptr) {
|
||||||
return c;
|
return c;
|
||||||
@ -5581,11 +5601,14 @@ bool ContactsManager::have_secret_chat_force(SecretChatId secret_chat_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ContactsManager::SecretChat *ContactsManager::get_secret_chat_force(SecretChatId secret_chat_id) {
|
ContactsManager::SecretChat *ContactsManager::get_secret_chat_force(SecretChatId secret_chat_id) {
|
||||||
|
if (!secret_chat_id.is_valid()) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
SecretChat *c = get_secret_chat(secret_chat_id);
|
SecretChat *c = get_secret_chat(secret_chat_id);
|
||||||
if (c != nullptr) {
|
if (c != nullptr) {
|
||||||
if (!have_user_force(c->user_id)) {
|
if (!have_user_force(c->user_id)) {
|
||||||
LOG(ERROR) << "Can't find " << c->user_id << " from " << secret_chat_id;
|
LOG(ERROR) << "Can't find " << c->user_id << " from " << secret_chat_id;
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
@ -9028,14 +9051,17 @@ int32 ContactsManager::get_basic_group_id_object(ChatId chat_id, const char *sou
|
|||||||
return chat_id.get();
|
return chat_id.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
tl_object_ptr<td_api::basicGroup> ContactsManager::get_basic_group_object(ChatId chat_id) const {
|
tl_object_ptr<td_api::basicGroup> ContactsManager::get_basic_group_object(ChatId chat_id) {
|
||||||
return get_basic_group_object(chat_id, get_chat(chat_id));
|
return get_basic_group_object(chat_id, get_chat(chat_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
tl_object_ptr<td_api::basicGroup> ContactsManager::get_basic_group_object(ChatId chat_id, const Chat *chat) const {
|
tl_object_ptr<td_api::basicGroup> ContactsManager::get_basic_group_object(ChatId chat_id, const Chat *chat) {
|
||||||
if (chat == nullptr) {
|
if (chat == nullptr) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
if (chat->migrated_to_channel_id.is_valid()) {
|
||||||
|
get_channel_force(chat->migrated_to_channel_id);
|
||||||
|
}
|
||||||
return make_tl_object<td_api::basicGroup>(
|
return make_tl_object<td_api::basicGroup>(
|
||||||
chat_id.get(), chat->participant_count, get_chat_status(chat).get_chat_member_status_object(),
|
chat_id.get(), chat->participant_count, get_chat_status(chat).get_chat_member_status_object(),
|
||||||
chat->everyone_is_administrator, chat->is_active,
|
chat->everyone_is_administrator, chat->is_active,
|
||||||
|
@ -376,7 +376,7 @@ class ContactsManager : public Actor {
|
|||||||
|
|
||||||
int32 get_basic_group_id_object(ChatId chat_id, const char *source) const;
|
int32 get_basic_group_id_object(ChatId chat_id, const char *source) const;
|
||||||
|
|
||||||
tl_object_ptr<td_api::basicGroup> get_basic_group_object(ChatId chat_id) const;
|
tl_object_ptr<td_api::basicGroup> get_basic_group_object(ChatId chat_id);
|
||||||
|
|
||||||
tl_object_ptr<td_api::basicGroupFullInfo> get_basic_group_full_info_object(ChatId chat_id) const;
|
tl_object_ptr<td_api::basicGroupFullInfo> get_basic_group_full_info_object(ChatId chat_id) const;
|
||||||
|
|
||||||
@ -945,7 +945,7 @@ class ContactsManager : public Actor {
|
|||||||
|
|
||||||
tl_object_ptr<td_api::userFullInfo> get_user_full_info_object(UserId user_id, const UserFull *user_full) const;
|
tl_object_ptr<td_api::userFullInfo> get_user_full_info_object(UserId user_id, const UserFull *user_full) const;
|
||||||
|
|
||||||
tl_object_ptr<td_api::basicGroup> get_basic_group_object(ChatId chat_id, const Chat *chat) const;
|
tl_object_ptr<td_api::basicGroup> get_basic_group_object(ChatId chat_id, const Chat *chat);
|
||||||
|
|
||||||
tl_object_ptr<td_api::basicGroupFullInfo> get_basic_group_full_info_object(const ChatFull *chat_full) const;
|
tl_object_ptr<td_api::basicGroupFullInfo> get_basic_group_full_info_object(const ChatFull *chat_full) const;
|
||||||
|
|
||||||
|
@ -19249,11 +19249,12 @@ std::pair<int32, vector<DialogParticipant>> MessagesManager::search_dialog_parti
|
|||||||
return td_->contacts_manager_->get_channel_participants(
|
return td_->contacts_manager_->get_channel_participants(
|
||||||
dialog_id.get_channel_id(), td_api::make_object<td_api::supergroupMembersFilterSearch>(query), 0, limit,
|
dialog_id.get_channel_id(), td_api::make_object<td_api::supergroupMembersFilterSearch>(query), 0, limit,
|
||||||
random_id, force, std::move(promise));
|
random_id, force, std::move(promise));
|
||||||
case DialogType::SecretChat:
|
case DialogType::SecretChat: {
|
||||||
promise.set_value(Unit());
|
promise.set_value(Unit());
|
||||||
return search_private_chat_participants(
|
auto peer_user_id = td_->contacts_manager_->get_secret_chat_user_id(dialog_id.get_secret_chat_id());
|
||||||
td_->contacts_manager_->get_my_id("search_dialog_participants"),
|
return search_private_chat_participants(td_->contacts_manager_->get_my_id("search_dialog_participants"),
|
||||||
td_->contacts_manager_->get_secret_chat_user_id(dialog_id.get_secret_chat_id()), query, limit);
|
peer_user_id, query, limit);
|
||||||
|
}
|
||||||
case DialogType::None:
|
case DialogType::None:
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
@ -1502,7 +1502,7 @@ void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateEncryptedChatTy
|
|||||||
}
|
}
|
||||||
|
|
||||||
UserId user_id = td_->contacts_manager_->get_secret_chat_user_id(secret_chat_id);
|
UserId user_id = td_->contacts_manager_->get_secret_chat_user_id(secret_chat_id);
|
||||||
if (!user_id.is_valid()) {
|
if (!td_->contacts_manager_->have_user_force(user_id)) {
|
||||||
LOG(DEBUG) << "Ignore secret chat typing of unknown " << user_id;
|
LOG(DEBUG) << "Ignore secret chat typing of unknown " << user_id;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user