Change default value also for users with message_db enabled

This commit is contained in:
Andrea Cavalli 2020-10-01 15:41:32 +02:00
parent c4137b1e7f
commit 637486c417
2 changed files with 8 additions and 4 deletions

View File

@ -10303,10 +10303,14 @@ void MessagesManager::delete_all_channel_messages_from_user_on_server(ChannelId
int32 MessagesManager::get_unload_dialog_delay() const {
constexpr int32 DIALOG_UNLOAD_DELAY = 60; // seconds
constexpr int32 DIALOG_UNLOAD_BOT_DELAY = 1800; // seconds
if (td_->auth_manager_->is_bot()) {
return narrow_cast<int32>(G()->shared_config().get_option_integer("chat_unload_delay", DIALOG_UNLOAD_BOT_DELAY));
auto is_bot = td_->auth_manager_->is_bot();
auto default_unload_delay = is_bot ? DIALOG_UNLOAD_BOT_DELAY : DIALOG_UNLOAD_DELAY;
if (G()->parameters().use_message_db || is_bot) {
return narrow_cast<int32>(G()->shared_config().get_option_integer("chat_unload_delay", default_unload_delay));
} else {
return DIALOG_UNLOAD_DELAY;
return default_unload_delay;
}
}

View File

@ -7123,7 +7123,7 @@ void Td::on_request(uint64 id, td_api::setOption &request) {
}
break;
case 'd':
if (is_bot && set_integer_option("chat_unload_delay", 60, 86400)) {
if ((parameters_.use_message_db || is_bot) && set_integer_option("chat_unload_delay", 60, 86400)) {
return;
}
if (!is_bot && set_boolean_option("disable_contact_registered_notifications")) {