mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Added counter label of characters limit to edit mode without media.
This commit is contained in:
parent
a77c547a62
commit
08717dcd78
2 changed files with 14 additions and 6 deletions
|
@ -7316,12 +7316,16 @@ void HistoryWidget::checkCharsLimitation() {
|
|||
return;
|
||||
}
|
||||
const auto item = session().data().message(_history->peer, _editMsgId);
|
||||
if (!item || !item->media() || !item->media()->allowsEditCaption()) {
|
||||
if (!item) {
|
||||
_charsLimitation = nullptr;
|
||||
return;
|
||||
}
|
||||
const auto remove = Ui::FieldCharacterCount(_field)
|
||||
- Data::PremiumLimits(&session()).captionLengthCurrent();
|
||||
const auto hasMediaWithCaption = item->media()
|
||||
&& item->media()->allowsEditCaption();
|
||||
const auto maxCaptionSize = !hasMediaWithCaption
|
||||
? MaxMessageSize
|
||||
: Data::PremiumLimits(&session()).captionLengthCurrent();
|
||||
const auto remove = Ui::FieldCharacterCount(_field) - maxCaptionSize;
|
||||
if (remove > 0) {
|
||||
if (!_charsLimitation) {
|
||||
_charsLimitation = base::make_unique_q<CharactersLimitLabel>(
|
||||
|
|
|
@ -3323,12 +3323,16 @@ void ComposeControls::checkCharsLimitation() {
|
|||
return;
|
||||
}
|
||||
const auto item = _history->owner().message(_header->editMsgId());
|
||||
if (!item || !item->media() || !item->media()->allowsEditCaption()) {
|
||||
if (!item) {
|
||||
_charsLimitation = nullptr;
|
||||
return;
|
||||
}
|
||||
const auto remove = Ui::FieldCharacterCount(_field)
|
||||
- Data::PremiumLimits(&session()).captionLengthCurrent();
|
||||
const auto hasMediaWithCaption = item->media()
|
||||
&& item->media()->allowsEditCaption();
|
||||
const auto maxCaptionSize = !hasMediaWithCaption
|
||||
? MaxMessageSize
|
||||
: Data::PremiumLimits(&session()).captionLengthCurrent();
|
||||
const auto remove = Ui::FieldCharacterCount(_field) - maxCaptionSize;
|
||||
if (remove > 0) {
|
||||
if (!_charsLimitation) {
|
||||
using namespace Controls;
|
||||
|
|
Loading…
Add table
Reference in a new issue