Added toast when limit for note length is reached.

This commit is contained in:
23rd
2025-09-25 22:26:23 +03:00
committed by John Preston
parent 68f0e25227
commit daa24de171
2 changed files with 18 additions and 0 deletions
+2
View File
@@ -4802,6 +4802,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_contact_phone_will_be_shared" = "You can make your phone visible to {user}.";
"lng_contact_add_notes" = "Note";
"lng_contact_add_notes_about" = "Notes are only visible to you.";
"lng_contact_notes_limit_reached#one" = "You've reached the contact note limit. Please make the note shorter by {count} character.";
"lng_contact_notes_limit_reached#other" = "You've reached the contact note limit. Please make the note shorter by {count} characters.";
"lng_suggest_photo_for" = "Suggest Photo for {user}";
"lng_suggest_birthday" = "Suggest Date of Birth";
"lng_suggest_birthday_box_title" = "{user}'s Date of Birth";
@@ -258,6 +258,22 @@ void Controller::initNameFields(
(inverted ? last : first)->showError();
return;
}
if (_notesField) {
const auto limit = Data::PremiumLimits(
&_user->session()).contactNoteLengthCurrent();
const auto remove = Ui::ComputeFieldCharacterCount(_notesField)
- limit;
if (remove > 0) {
_box->showToast(tr::lng_contact_notes_limit_reached(
tr::now,
lt_count,
remove));
_notesField->setFocus();
return;
}
}
const auto user = _user;
const auto personal = _updatedPersonalPhoto
? _updatedPersonalPhoto()