Slightly improved share message phrase factory to be more flexible.

This commit is contained in:
23rd
2025-10-03 11:27:28 +03:00
committed by John Preston
parent eb96fd1b97
commit a396f507f8
4 changed files with 13 additions and 3 deletions
+6 -2
View File
@@ -1796,7 +1796,9 @@ ShareBox::SubmitCallback ShareBox::DefaultForwardCallback(
auto phrase = rpl::variable<TextWithEntities>(
ChatHelpers::ForwardedMessagePhrase(
donePhraseArgs)).current();
show->showToast(std::move(phrase));
if (!phrase.empty()) {
show->showToast(std::move(phrase));
}
show->hideLayer();
}
}
@@ -1954,7 +1956,9 @@ void FastShareMessageToSelf(
auto phrase = rpl::variable<TextWithEntities>(
ChatHelpers::ForwardedMessagePhrase(
donePhraseArgs)).current();
show->showToast(std::move(phrase));
if (!phrase.empty()) {
show->showToast(std::move(phrase));
}
});
}
@@ -19,6 +19,9 @@ rpl::producer<TextWithEntities> ForwardedMessagePhrase(
Assert(args.to1);
if (args.to1->isSelf()) {
if (args.toSelfWithPremiumIsEmpty && args.to1->isPremium()) {
return {};
}
return (args.singleMessage
? tr::lng_share_message_to_saved_messages
: tr::lng_share_messages_to_saved_messages)(
@@ -16,6 +16,7 @@ struct ForwardedMessagePhraseArgs final {
bool singleMessage = false;
PeerData *to1 = nullptr;
PeerData *to2 = nullptr;
bool toSelfWithPremiumIsEmpty = true;
};
rpl::producer<TextWithEntities> ForwardedMessagePhrase(
@@ -3908,7 +3908,9 @@ void ForwardToSelf(
.singleMessage = (count == 1),
.to1 = session->user(),
})).current();
show->showToast(std::move(phrase));
if (!phrase.empty()) {
show->showToast(std::move(phrase));
}
});
}
}