Add bio_length_max option.
This commit is contained in:
parent
549b86371d
commit
42ab42c83a
@ -5911,7 +5911,7 @@ deleteProfilePhoto profile_photo_id:int64 = Ok;
|
|||||||
//@description Changes the first and last name of the current user @first_name The new value of the first name for the current user; 1-64 characters @last_name The new value of the optional last name for the current user; 0-64 characters
|
//@description Changes the first and last name of the current user @first_name The new value of the first name for the current user; 1-64 characters @last_name The new value of the optional last name for the current user; 0-64 characters
|
||||||
setName first_name:string last_name:string = Ok;
|
setName first_name:string last_name:string = Ok;
|
||||||
|
|
||||||
//@description Changes the bio of the current user @bio The new value of the user bio; 0-70 characters without line feeds
|
//@description Changes the bio of the current user @bio The new value of the user bio; 0-GetOption("bio_length_max") characters without line feeds
|
||||||
setBio bio:string = Ok;
|
setBio bio:string = Ok;
|
||||||
|
|
||||||
//@description Changes the username of the current user @username The new value of the username. Use an empty string to remove the username
|
//@description Changes the username of the current user @username The new value of the username. Use an empty string to remove the username
|
||||||
|
@ -1875,6 +1875,10 @@ void ConfigManager::process_app_config(tl_object_ptr<telegram_api::JSONValue> &c
|
|||||||
shared_config.set_option_integer("chat_filter_chosen_chat_count_max",
|
shared_config.set_option_integer("chat_filter_chosen_chat_count_max",
|
||||||
static_cast<int32>(chat_filter_chosen_chat_count_max));
|
static_cast<int32>(chat_filter_chosen_chat_count_max));
|
||||||
|
|
||||||
|
auto bio_length_max = shared_config.get_option_integer(
|
||||||
|
is_premium ? Slice("about_length_limit_premium") : Slice("about_length_limit_default"), is_premium ? 140 : 70);
|
||||||
|
shared_config.set_option_integer("bio_length_max", bio_length_max);
|
||||||
|
|
||||||
shared_config.set_option_string("premium_features", implode(premium_features, ','));
|
shared_config.set_option_string("premium_features", implode(premium_features, ','));
|
||||||
if (premium_bot_username.empty()) {
|
if (premium_bot_username.empty()) {
|
||||||
shared_config.set_option_empty("premium_bot_username");
|
shared_config.set_option_empty("premium_bot_username");
|
||||||
|
@ -6456,7 +6456,8 @@ void ContactsManager::set_name(const string &first_name, const string &last_name
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ContactsManager::set_bio(const string &bio, Promise<Unit> &&promise) {
|
void ContactsManager::set_bio(const string &bio, Promise<Unit> &&promise) {
|
||||||
auto new_bio = strip_empty_characters(bio, MAX_BIO_LENGTH);
|
auto max_bio_length = static_cast<size_t>(G()->shared_config().get_option_integer("bio_length_max"));
|
||||||
|
auto new_bio = strip_empty_characters(bio, max_bio_length);
|
||||||
for (auto &c : new_bio) {
|
for (auto &c : new_bio) {
|
||||||
if (c == '\n') {
|
if (c == '\n') {
|
||||||
c = ' ';
|
c = ' ';
|
||||||
|
@ -1024,7 +1024,6 @@ class ContactsManager final : public Actor {
|
|||||||
static constexpr int32 MAX_GET_PROFILE_PHOTOS = 100; // server side limit
|
static constexpr int32 MAX_GET_PROFILE_PHOTOS = 100; // server side limit
|
||||||
static constexpr size_t MAX_NAME_LENGTH = 64; // server side limit for first/last name
|
static constexpr size_t MAX_NAME_LENGTH = 64; // server side limit for first/last name
|
||||||
static constexpr size_t MAX_DESCRIPTION_LENGTH = 255; // server side limit for chat/channel description
|
static constexpr size_t MAX_DESCRIPTION_LENGTH = 255; // server side limit for chat/channel description
|
||||||
static constexpr size_t MAX_BIO_LENGTH = 70; // server side limit
|
|
||||||
static constexpr size_t MAX_INVITE_LINK_TITLE_LENGTH = 32; // server side limit
|
static constexpr size_t MAX_INVITE_LINK_TITLE_LENGTH = 32; // server side limit
|
||||||
static constexpr int32 MAX_GET_CHANNEL_PARTICIPANTS = 200; // server side limit
|
static constexpr int32 MAX_GET_CHANNEL_PARTICIPANTS = 200; // server side limit
|
||||||
|
|
||||||
|
@ -93,6 +93,9 @@ OptionManager::OptionManager(Td *td, ActorShared<> parent) : td_(td), parent_(st
|
|||||||
if (!G()->shared_config().have_option("message_caption_length_max")) {
|
if (!G()->shared_config().have_option("message_caption_length_max")) {
|
||||||
G()->shared_config().set_option_integer("message_caption_length_max", 1024);
|
G()->shared_config().set_option_integer("message_caption_length_max", 1024);
|
||||||
}
|
}
|
||||||
|
if (!G()->shared_config().have_option("bio_length_max")) {
|
||||||
|
G()->shared_config().set_option_integer("bio_length_max", 70);
|
||||||
|
}
|
||||||
if (!G()->shared_config().have_option("suggested_video_note_length")) {
|
if (!G()->shared_config().have_option("suggested_video_note_length")) {
|
||||||
G()->shared_config().set_option_integer("suggested_video_note_length", 384);
|
G()->shared_config().set_option_integer("suggested_video_note_length", 384);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user