diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index cd50c4d7e..7274d2389 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -2260,6 +2260,10 @@ class GetCreatedPublicChannelsQuery final : public Td::ResultHandler { if (type_ == PublicDialogType::IsLocationBased) { flags |= telegram_api::channels_getAdminedPublicChannels::BY_LOCATION_MASK; } + if (type_ == PublicDialogType::ForPersonalDialog) { + CHECK(!check_limit); + flags |= telegram_api::channels_getAdminedPublicChannels::FOR_PERSONAL_MASK; + } if (check_limit) { flags |= telegram_api::channels_getAdminedPublicChannels::CHECK_LIMIT_MASK; } @@ -7232,6 +7236,8 @@ bool ContactsManager::is_suitable_created_public_channel(PublicDialogType type, return c->usernames.has_editable_username(); case PublicDialogType::IsLocationBased: return c->has_location; + case PublicDialogType::ForPersonalDialog: + return !c->is_megagroup && c->usernames.has_first_username(); default: UNREACHABLE(); return false; @@ -7324,7 +7330,8 @@ void ContactsManager::finish_get_created_public_dialogs(PublicDialogType type, R } void ContactsManager::update_created_public_channels(Channel *c, ChannelId channel_id) { - for (auto type : {PublicDialogType::HasUsername, PublicDialogType::IsLocationBased}) { + for (auto type : + {PublicDialogType::HasUsername, PublicDialogType::IsLocationBased, PublicDialogType::ForPersonalDialog}) { auto index = static_cast(type); if (!created_public_channels_inited_[index]) { continue; diff --git a/td/telegram/ContactsManager.h b/td/telegram/ContactsManager.h index 4685dec6b..54d621628 100644 --- a/td/telegram/ContactsManager.h +++ b/td/telegram/ContactsManager.h @@ -1710,9 +1710,9 @@ class ContactsManager final : public Actor { FlatHashMap, UserIdHash> secret_chats_with_user_; - bool created_public_channels_inited_[2] = {false, false}; - vector created_public_channels_[2]; - vector>> get_created_public_channels_queries_[2]; + bool created_public_channels_inited_[3] = {false, false, false}; + vector created_public_channels_[3]; + vector>> get_created_public_channels_queries_[3]; bool dialogs_for_discussion_inited_ = false; vector dialogs_for_discussion_; diff --git a/td/telegram/PublicDialogType.h b/td/telegram/PublicDialogType.h index ebc9ff37d..a6bbd8844 100644 --- a/td/telegram/PublicDialogType.h +++ b/td/telegram/PublicDialogType.h @@ -10,7 +10,7 @@ namespace td { -enum class PublicDialogType : int32 { HasUsername, IsLocationBased }; +enum class PublicDialogType : int32 { HasUsername, IsLocationBased, ForPersonalDialog }; inline PublicDialogType get_public_dialog_type(const td_api::object_ptr &type) { if (type == nullptr || type->get_id() == td_api::publicChatTypeHasUsername::ID) { diff --git a/td/telegram/UpdatesManager.cpp b/td/telegram/UpdatesManager.cpp index 65f4e4060..56a664274 100644 --- a/td/telegram/UpdatesManager.cpp +++ b/td/telegram/UpdatesManager.cpp @@ -2267,6 +2267,7 @@ void UpdatesManager::try_reload_data() { td_->autosave_manager_->reload_autosave_settings(); td_->contacts_manager_->reload_created_public_dialogs(PublicDialogType::HasUsername, std::move(promise)); td_->contacts_manager_->reload_created_public_dialogs(PublicDialogType::IsLocationBased, Auto()); + td_->contacts_manager_->reload_created_public_dialogs(PublicDialogType::ForPersonalDialog, Auto()); get_default_emoji_statuses(td_, Auto()); get_default_channel_emoji_statuses(td_, Auto()); td_->notification_settings_manager_->reload_saved_ringtones(Auto());