Fix setting disable_top_chats option before logging in as a bot.

GitOrigin-RevId: 0fee9765a3bdcc56dd81a7e75b2dc2e9745a70bb
This commit is contained in:
levlam 2019-03-06 01:06:33 +03:00
parent 32ac05693b
commit 48077eb861

View File

@ -94,6 +94,11 @@ static tl_object_ptr<telegram_api::TopPeerCategory> top_dialog_category_as_teleg
} }
void TopDialogManager::update_is_enabled(bool is_enabled) { void TopDialogManager::update_is_enabled(bool is_enabled) {
auto auth_manager = G()->td().get_actor_unsafe()->auth_manager_.get();
if (auth_manager == nullptr || !auth_manager->is_authorized() || auth_manager->is_bot()) {
return;
}
if (set_is_enabled(is_enabled)) { if (set_is_enabled(is_enabled)) {
G()->td_db()->get_binlog_pmc()->set("top_peers_enabled", is_enabled ? "1" : "0"); G()->td_db()->get_binlog_pmc()->set("top_peers_enabled", is_enabled ? "1" : "0");
send_toggle_top_peers(is_enabled); send_toggle_top_peers(is_enabled);