Add "can_set_new_chat_privacy_settings" option.

This commit is contained in:
levlam 2024-03-29 16:51:53 +03:00
parent 2930b87c86
commit fd1d1dbb6c
3 changed files with 13 additions and 2 deletions

View File

@ -8792,7 +8792,7 @@ canSendStory chat_id:int53 = CanSendStoryResult;
//@chat_id Identifier of the chat that will post the story
//@content Content of the story
//@areas Clickable rectangle areas to be shown on the story media; pass null if none
//@caption Story caption; pass null to use an empty caption; 0-getOption("story_caption_length_max") characters
//@caption Story caption; pass null to use an empty caption; 0-getOption("story_caption_length_max") characters; can have entities only if getOption("can_use_text_entities_in_story_caption")
//@privacy_settings The privacy settings for the story; ignored for stories sent to supergroup and channel chats
//@active_period Period after which the story is moved to archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400 for Telegram Premium users, and 86400 otherwise
//@from_story_full_id Full identifier of the original story, which content was used to create the story
@ -10004,7 +10004,7 @@ setReadDatePrivacySettings settings:readDatePrivacySettings = Ok;
//@description Returns privacy settings for message read date
getReadDatePrivacySettings = ReadDatePrivacySettings;
//@description Changes privacy settings for new chat creation; for Telegram Premium users only @settings New settings
//@description Changes privacy settings for new chat creation; can be used only if getOption("can_set_new_chat_privacy_settings") @settings New settings
setNewChatPrivacySettings settings:newChatPrivacySettings = Ok;
//@description Returns privacy settings for new chat creation

View File

@ -2015,6 +2015,11 @@ void ConfigManager::process_app_config(tl_object_ptr<telegram_api::JSONValue> &c
}
continue;
}
if (key == "new_noncontact_peers_require_premium_without_ownpremium") {
G()->set_option_boolean("need_premium_for_new_chat_privacy",
!get_json_value_bool(std::move(key_value->value_), key));
continue;
}
new_values.push_back(std::move(key_value));
}

View File

@ -183,6 +183,7 @@ void OptionManager::update_premium_options() {
set_option_integer("story_suggested_reaction_area_count_max",
get_option_integer("stories_suggested_reactions_limit_premium", 5));
set_option_boolean("can_set_new_chat_privacy_settings", true);
set_option_boolean("can_use_text_entities_in_story_caption", true);
} else {
set_option_integer("saved_animations_limit", get_option_integer("saved_gifs_limit_default", 200));
@ -206,6 +207,7 @@ void OptionManager::update_premium_options() {
set_option_integer("story_suggested_reaction_area_count_max",
get_option_integer("stories_suggested_reactions_limit_default", 1));
set_option_boolean("can_set_new_chat_privacy_settings", !get_option_boolean("need_premium_for_new_chat_privacy"));
set_option_boolean("can_use_text_entities_in_story_caption",
!get_option_boolean("need_premium_for_story_caption_entities"));
}
@ -387,6 +389,7 @@ bool OptionManager::is_internal_option(Slice name) {
"ignored_restriction_reasons",
"language_pack_version",
"my_phone_number",
"need_premium_for_new_chat_privacy",
"need_premium_for_story_caption_entities",
"need_synchronize_archive_all_stories",
"notification_cloud_delay_ms",
@ -550,6 +553,9 @@ void OptionManager::on_option_updated(Slice name) {
}
break;
case 'n':
if (name == "need_premium_for_new_chat_privacy") {
update_premium_options();
}
if (name == "need_premium_for_story_caption_entities") {
update_premium_options();
}