Fix phrases for rejected/failed suggestion.

This commit is contained in:
John Preston 2025-07-04 16:45:24 +04:00
parent 7ccf26310d
commit 8a0869fb75
3 changed files with 18 additions and 6 deletions

View file

@ -2280,6 +2280,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_action_suggest_success_ton#other" = "{from} has received {count} TON for publishing post.";
"lng_action_suggest_refund_user" = "User refunded the Stars so that post was deleted.";
"lng_action_suggest_refund_admin" = "Admin deleted the post early so that the price was refunded to the user.";
"lng_action_post_rejected" = "The post was rejected.";
"lng_action_not_enough_funds" = "Transaction failed.";
"lng_you_paid_stars#one" = "You paid {count} Star.";
"lng_you_paid_stars#other" = "You paid {count} Stars.";

View file

@ -6087,7 +6087,11 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) {
};
auto prepareSuggestedPostApproval = [&](const MTPDmessageActionSuggestedPostApproval &data) {
return PreparedServiceText{ { tr::lng_suggest_action_agreement(tr::now) } };
return PreparedServiceText{ { data.is_rejected()
? tr::lng_action_post_rejected(tr::now)
: data.is_balance_too_low()
? tr::lng_action_not_enough_funds(tr::now)
: tr::lng_suggest_action_agreement(tr::now) } };
};
auto prepareSuggestedPostSuccess = [&](const MTPDmessageActionSuggestedPostSuccess &data) {

View file

@ -322,13 +322,19 @@ QSize MediaGenericTextPart::countOptimalSize() {
QSize MediaGenericTextPart::countCurrentSize(int newWidth) {
auto skip = _margins.left() + _margins.right();
const auto size = CountOptimalTextSize(
_text,
st::msgMinWidth,
std::max(st::msgMinWidth, newWidth - skip));
const auto size = (_align == style::al_top)
? CountOptimalTextSize(
_text,
st::msgMinWidth,
std::max(st::msgMinWidth, newWidth - skip))
: QSize(newWidth - skip, _text.countHeight(newWidth - skip));
const auto lines = elisionLines();
const auto height = lines
? std::min(size.height(), lines * _text.style()->font->height)
: size.height();
return {
size.width() + skip,
_margins.top() + size.height() + _margins.bottom(),
_margins.top() + height + _margins.bottom(),
};
}