From b1cc7b25ba0d94d1c109a7d0912b2248d2228bc3 Mon Sep 17 00:00:00 2001 From: John Preston Date: Sun, 11 Mar 2018 23:22:43 +0300 Subject: [PATCH] Add group/channel info limit in EditPeerInfoBox. --- Telegram/SourceFiles/boxes/add_contact_box.cpp | 2 +- Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Telegram/SourceFiles/boxes/add_contact_box.cpp b/Telegram/SourceFiles/boxes/add_contact_box.cpp index 257e03af7..c87b88d7b 100644 --- a/Telegram/SourceFiles/boxes/add_contact_box.cpp +++ b/Telegram/SourceFiles/boxes/add_contact_box.cpp @@ -33,7 +33,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL namespace { constexpr auto kMaxGroupChannelTitle = 255; -constexpr auto kMaxChannelDescription = 255; +constexpr auto kMaxChannelDescription = 255; // See also edit_peer_info_box. constexpr auto kMaxBioLength = 70; constexpr auto kMinUsernameLength = 5; diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp index 0c5a66cd3..b82496332 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp @@ -38,6 +38,7 @@ namespace { constexpr auto kUsernameCheckTimeout = TimeMs(200); constexpr auto kMinUsernameLength = 5; +constexpr auto kMaxChannelDescription = 255; // See also add_contact_box. class Controller : private MTP::Sender @@ -324,6 +325,7 @@ object_ptr Controller::createDescriptionEdit() { langFactory(lng_create_group_description), channel->about()), st::editPeerDescriptionMargins); + result->entity()->setMaxLength(kMaxChannelDescription); QObject::connect( result->entity(), @@ -1252,11 +1254,9 @@ void Controller::saveTitle() { continueSave(); return; } + _controls.title->showError(); if (type == qstr("NO_CHAT_TITLE")) { - _controls.title->showError(); _box->scrollToWidget(_controls.title); - } else { - _controls.title->setFocus(); } cancelSave(); }; @@ -1302,7 +1302,7 @@ void Controller::saveDescription() { successCallback(); return; } - _controls.description->setFocus(); + _controls.description->showError(); cancelSave(); }).send(); }