mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Fixed text suggestion in toast when media caption is too long.
This commit is contained in:
parent
5cd0d82ffb
commit
d1eaf284b1
3 changed files with 18 additions and 6 deletions
|
@ -3870,7 +3870,11 @@ void HistoryWidget::saveEditMsg() {
|
|||
auto sending = TextWithEntities();
|
||||
|
||||
const auto media = item->media();
|
||||
if (!TextUtilities::CutPart(sending, left, MaxMessageSize)
|
||||
|
||||
const auto originalLeftSize = left.text.size();
|
||||
const auto maxCaptionSize = Data::PremiumLimits(
|
||||
&session()).captionLengthCurrent();
|
||||
if (!TextUtilities::CutPart(sending, left, maxCaptionSize)
|
||||
&& (webPageDraft.removed
|
||||
|| webPageDraft.url.isEmpty()
|
||||
|| !webPageDraft.manual)
|
||||
|
@ -3880,7 +3884,7 @@ void HistoryWidget::saveEditMsg() {
|
|||
Box<DeleteMessagesBox>(item, suggestModerateActions));
|
||||
return;
|
||||
} else if (!left.text.isEmpty()) {
|
||||
const auto remove = left.text.size();
|
||||
const auto remove = originalLeftSize - maxCaptionSize;
|
||||
controller()->showToast(
|
||||
tr::lng_edit_limit_reached(tr::now, lt_count, remove));
|
||||
return;
|
||||
|
|
|
@ -79,6 +79,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "data/data_changes.h"
|
||||
#include "data/data_shared_media.h"
|
||||
#include "data/data_send_action.h"
|
||||
#include "data/data_premium_limits.h"
|
||||
#include "storage/storage_media_prepare.h"
|
||||
#include "storage/storage_shared_media.h"
|
||||
#include "storage/storage_account.h"
|
||||
|
@ -1233,7 +1234,10 @@ void RepliesWidget::edit(
|
|||
auto sending = TextWithEntities();
|
||||
auto left = _composeControls->prepareTextForEditMsg();
|
||||
|
||||
if (!TextUtilities::CutPart(sending, left, MaxMessageSize)
|
||||
const auto originalLeftSize = left.text.size();
|
||||
const auto maxCaptionSize = Data::PremiumLimits(
|
||||
&session()).captionLengthCurrent();
|
||||
if (!TextUtilities::CutPart(sending, left, maxCaptionSize)
|
||||
&& (!item
|
||||
|| !item->media()
|
||||
|| !item->media()->allowsEditCaption())) {
|
||||
|
@ -1244,7 +1248,7 @@ void RepliesWidget::edit(
|
|||
}
|
||||
return;
|
||||
} else if (!left.text.isEmpty()) {
|
||||
const auto remove = left.text.size();
|
||||
const auto remove = originalLeftSize - maxCaptionSize;
|
||||
controller()->showToast(
|
||||
tr::lng_edit_limit_reached(tr::now, lt_count, remove));
|
||||
return;
|
||||
|
|
|
@ -53,6 +53,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "data/data_user.h"
|
||||
#include "data/data_message_reactions.h"
|
||||
#include "data/data_peer_values.h"
|
||||
#include "data/data_premium_limits.h"
|
||||
#include "storage/storage_media_prepare.h"
|
||||
#include "storage/storage_account.h"
|
||||
#include "storage/localimageloader.h"
|
||||
|
@ -653,7 +654,10 @@ void ScheduledWidget::edit(
|
|||
auto sending = TextWithEntities();
|
||||
auto left = _composeControls->prepareTextForEditMsg();
|
||||
|
||||
if (!TextUtilities::CutPart(sending, left, MaxMessageSize)
|
||||
const auto originalLeftSize = left.text.size();
|
||||
const auto maxCaptionSize = Data::PremiumLimits(
|
||||
&session()).captionLengthCurrent();
|
||||
if (!TextUtilities::CutPart(sending, left, maxCaptionSize)
|
||||
&& (!item
|
||||
|| !item->media()
|
||||
|| !item->media()->allowsEditCaption())) {
|
||||
|
@ -664,7 +668,7 @@ void ScheduledWidget::edit(
|
|||
}
|
||||
return;
|
||||
} else if (!left.text.isEmpty()) {
|
||||
const auto remove = left.text.size();
|
||||
const auto remove = originalLeftSize - maxCaptionSize;
|
||||
controller()->showToast(
|
||||
tr::lng_edit_limit_reached(tr::now, lt_count, remove));
|
||||
return;
|
||||
|
|
Loading…
Add table
Reference in a new issue