Improve phrases for forward-from-saved.

This commit is contained in:
John Preston 2025-01-31 14:45:06 +04:00
parent 1c8b165a64
commit 428a3cf0ce
3 changed files with 13 additions and 2 deletions

View file

@ -947,7 +947,8 @@ void DraftOptionsBox(
AddFilledSkip(bottom); AddFilledSkip(bottom);
if (!hasOnlyForcedForwardedInfo) { if (!hasOnlyForcedForwardedInfo
&& !HasOnlyDroppedForwardedInfo(items)) {
Settings::AddButtonWithIcon( Settings::AddButtonWithIcon(
bottom, bottom,
(dropNames (dropNames

View file

@ -153,7 +153,7 @@ void ForwardPanel::updateTexts() {
Unexpected("Corrupt forwarded information in message."); Unexpected("Corrupt forwarded information in message.");
} }
} }
if (!keepNames) { if (!keepNames || HasOnlyDroppedForwardedInfo(_data.items)) {
from = tr::lng_forward_sender_names_removed(tr::now); from = tr::lng_forward_sender_names_removed(tr::now);
} else if (names.size() > 2) { } else if (names.size() > 2) {
from = tr::lng_forwarding_from( from = tr::lng_forwarding_from(
@ -445,4 +445,13 @@ bool HasOnlyForcedForwardedInfo(const HistoryItemsList &list) {
return true; return true;
} }
bool HasOnlyDroppedForwardedInfo(const HistoryItemsList &list) {
for (const auto &item : list) {
if (!item->computeDropForwardedInfo()) {
return false;
}
}
return true;
}
} // namespace HistoryView::Controls } // namespace HistoryView::Controls

View file

@ -85,5 +85,6 @@ void EditWebPageOptions(
Fn<void(Data::WebPageDraft)> done); Fn<void(Data::WebPageDraft)> done);
[[nodiscard]] bool HasOnlyForcedForwardedInfo(const HistoryItemsList &list); [[nodiscard]] bool HasOnlyForcedForwardedInfo(const HistoryItemsList &list);
[[nodiscard]] bool HasOnlyDroppedForwardedInfo(const HistoryItemsList &list);
} // namespace HistoryView::Controls } // namespace HistoryView::Controls