Skip to content

Commit

Permalink
Beta version 1.4.4: Correct caption limit.
Browse files Browse the repository at this point in the history
  • Loading branch information
john-preston committed Oct 17, 2018
1 parent 54f2b1b commit c5d20a2
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Telegram/SourceFiles/boxes/edit_caption_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ EditCaptionBox::EditCaptionBox(
Ui::InputField::Mode::MultiLine,
langFactory(lng_photo_caption),
editData);
_field->setMaxLength(MaxPhotoCaption);
_field->setMaxLength(Global::CaptionLengthMax());
_field->setSubmitSettings(Ui::InputField::SubmitSettings::Both);
_field->setInstantReplaces(Ui::InstantReplaces::Default());
_field->setInstantReplacesEnabled(Global::ReplaceEmojiValue());
Expand Down
3 changes: 2 additions & 1 deletion Telegram/SourceFiles/boxes/rate_call_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ For license and copyright information please follow this link:
namespace {

constexpr auto kMaxRating = 5;
constexpr auto kRateCallCommentLengthMax = 200;

} // namespace

Expand Down Expand Up @@ -78,7 +79,7 @@ void RateCallBox::ratingChanged(int value) {
langFactory(lng_call_rate_comment));
_comment->show();
_comment->setSubmitSettings(Ui::InputField::SubmitSettings::Both);
_comment->setMaxLength(MaxPhotoCaption);
_comment->setMaxLength(kRateCallCommentLengthMax);
_comment->resize(width() - (st::callRatingPadding.left() + st::callRatingPadding.right()), _comment->height());

updateMaxHeight();
Expand Down
8 changes: 7 additions & 1 deletion Telegram/SourceFiles/boxes/report_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ For license and copyright information please follow this link:
#include "ui/toast/toast.h"
#include "mainwindow.h"

namespace {

constexpr auto kReportReasonLengthMax = 200;

} // namespace

ReportBox::ReportBox(QWidget*, not_null<PeerData*> peer)
: _peer(peer) {
}
Expand Down Expand Up @@ -89,7 +95,7 @@ void ReportBox::reasonChanged(Reason reason) {
langFactory(lng_report_reason_description));
_reasonOtherText->show();
_reasonOtherText->setSubmitSettings(Ui::InputField::SubmitSettings::Both);
_reasonOtherText->setMaxLength(MaxPhotoCaption);
_reasonOtherText->setMaxLength(kReportReasonLengthMax);
_reasonOtherText->resize(width() - (st::boxPadding.left() + st::boxOptionListPadding.left() + st::boxPadding.right()), _reasonOtherText->height());

updateMaxHeight();
Expand Down
2 changes: 1 addition & 1 deletion Telegram/SourceFiles/boxes/send_files_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1556,7 +1556,7 @@ void SendFilesBox::applyAlbumOrder() {
}

void SendFilesBox::setupCaption() {
_caption->setMaxLength(MaxPhotoCaption);
_caption->setMaxLength(Global::CaptionLengthMax());
_caption->setSubmitSettings(Ui::InputField::SubmitSettings::Both);
connect(_caption, &Ui::InputField::resized, [=] {
captionResized();
Expand Down
2 changes: 0 additions & 2 deletions Telegram/SourceFiles/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ enum {
SearchPeopleLimit = 5,
UsernameCheckTimeout = 200,

MaxPhotoCaption = 200,

MaxMessageSize = 4096,

WriteMapTimeout = 1000,
Expand Down
2 changes: 2 additions & 0 deletions Telegram/SourceFiles/facades.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,7 @@ struct Data {
: qsl("apv2.stel.com");
bool PhoneCallsEnabled = true;
bool BlockedMode = false;
int32 CaptionLengthMax = 1024;
base::Observable<void> PhoneCallsEnabledChanged;

HiddenPinnedMessagesMap HiddenPinnedMessages;
Expand Down Expand Up @@ -750,6 +751,7 @@ DefineVar(Global, int32, WebFileDcId);
DefineVar(Global, QString, TxtDomainString);
DefineVar(Global, bool, PhoneCallsEnabled);
DefineVar(Global, bool, BlockedMode);
DefineVar(Global, int32, CaptionLengthMax);
DefineRefVar(Global, base::Observable<void>, PhoneCallsEnabledChanged);

DefineVar(Global, HiddenPinnedMessagesMap, HiddenPinnedMessages);
Expand Down
1 change: 1 addition & 0 deletions Telegram/SourceFiles/facades.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ DeclareVar(int32, WebFileDcId);
DeclareVar(QString, TxtDomainString);
DeclareVar(bool, PhoneCallsEnabled);
DeclareVar(bool, BlockedMode);
DeclareVar(int32, CaptionLengthMax);
DeclareRefVar(base::Observable<void>, PhoneCallsEnabledChanged);

typedef QMap<PeerId, MsgId> HiddenPinnedMessagesMap;
Expand Down
1 change: 1 addition & 0 deletions Telegram/SourceFiles/mtproto/mtp_instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,7 @@ void Instance::Private::configLoadDone(const MTPConfig &result) {
Global::RefPhoneCallsEnabledChanged().notify();
}
Global::SetBlockedMode(data.is_blocked_mode());
Global::SetCaptionLengthMax(data.vcaption_length_max.v);

const auto lang = data.has_suggested_lang_code()
? qs(data.vsuggested_lang_code)
Expand Down

0 comments on commit c5d20a2

Please sign in to comment.