Add force to get_channel_full.

GitOrigin-RevId: 76bc8e90bc5aba1443739199800074bf52e7d8d3
This commit is contained in:
levlam 2020-04-02 04:33:04 +03:00
parent d8f18bd694
commit 1cb2141fee
4 changed files with 7 additions and 7 deletions

View File

@ -12185,7 +12185,7 @@ ContactsManager::ChannelFull *ContactsManager::add_channel_full(ChannelId channe
return channel_full_ptr.get(); return channel_full_ptr.get();
} }
bool ContactsManager::get_channel_full(ChannelId channel_id, Promise<Unit> &&promise) { bool ContactsManager::get_channel_full(ChannelId channel_id, bool force, Promise<Unit> &&promise) {
auto channel_full = get_channel_full_force(channel_id); auto channel_full = get_channel_full_force(channel_id);
if (channel_full == nullptr) { if (channel_full == nullptr) {
auto input_channel = get_input_channel(channel_id); auto input_channel = get_input_channel(channel_id);
@ -12198,7 +12198,7 @@ bool ContactsManager::get_channel_full(ChannelId channel_id, Promise<Unit> &&pro
return false; return false;
} }
if (channel_full->is_expired()) { if (channel_full->is_expired()) {
if (td_->auth_manager_->is_bot()) { if (td_->auth_manager_->is_bot() && !force) {
auto input_channel = get_input_channel(channel_id); auto input_channel = get_input_channel(channel_id);
CHECK(input_channel != nullptr); CHECK(input_channel != nullptr);
send_get_channel_full_query(channel_full, channel_id, std::move(input_channel), std::move(promise), send_get_channel_full_query(channel_full, channel_id, std::move(input_channel), std::move(promise),

View File

@ -453,7 +453,7 @@ class ContactsManager : public Actor {
bool have_channel_force(ChannelId channel_id); bool have_channel_force(ChannelId channel_id);
bool get_channel(ChannelId channel_id, int left_tries, Promise<Unit> &&promise); bool get_channel(ChannelId channel_id, int left_tries, Promise<Unit> &&promise);
void reload_channel(ChannelId chnanel_id, Promise<Unit> &&promise); void reload_channel(ChannelId chnanel_id, Promise<Unit> &&promise);
bool get_channel_full(ChannelId channel_id, Promise<Unit> &&promise); bool get_channel_full(ChannelId channel_id, bool force, Promise<Unit> &&promise);
bool is_channel_public(ChannelId channel_id) const; bool is_channel_public(ChannelId channel_id) const;

View File

@ -9528,7 +9528,7 @@ void MessagesManager::repair_channel_server_unread_count(Dialog *d) {
} }
LOG(INFO) << "Reload ChannelFull for " << d->dialog_id << " to repair unread message counts"; LOG(INFO) << "Reload ChannelFull for " << d->dialog_id << " to repair unread message counts";
td_->contacts_manager_->get_channel_full(d->dialog_id.get_channel_id(), Promise<Unit>()); td_->contacts_manager_->get_channel_full(d->dialog_id.get_channel_id(), false, Promise<Unit>());
} }
void MessagesManager::read_history_inbox(DialogId dialog_id, MessageId max_message_id, int32 unread_count, void MessagesManager::read_history_inbox(DialogId dialog_id, MessageId max_message_id, int32 unread_count,
@ -13764,10 +13764,10 @@ void MessagesManager::get_dialog_info_full(DialogId dialog_id, Promise<Unit> &&p
td_->contacts_manager_->get_user_full(dialog_id.get_user_id(), std::move(promise)); td_->contacts_manager_->get_user_full(dialog_id.get_user_id(), std::move(promise));
return; return;
case DialogType::Chat: case DialogType::Chat:
td_->contacts_manager_->get_chat_full(dialog_id.get_chat_id(), true, std::move(promise)); td_->contacts_manager_->get_chat_full(dialog_id.get_chat_id(), false, std::move(promise));
return; return;
case DialogType::Channel: case DialogType::Channel:
td_->contacts_manager_->get_channel_full(dialog_id.get_channel_id(), std::move(promise)); td_->contacts_manager_->get_channel_full(dialog_id.get_channel_id(), false, std::move(promise));
return; return;
case DialogType::SecretChat: case DialogType::SecretChat:
return promise.set_value(Unit()); return promise.set_value(Unit());

View File

@ -748,7 +748,7 @@ class GetSupergroupFullInfoRequest : public RequestActor<> {
ChannelId channel_id_; ChannelId channel_id_;
void do_run(Promise<Unit> &&promise) override { void do_run(Promise<Unit> &&promise) override {
td->contacts_manager_->get_channel_full(channel_id_, std::move(promise)); td->contacts_manager_->get_channel_full(channel_id_, get_tries() < 2, std::move(promise));
} }
void do_send_result() override { void do_send_result() override {