mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 15:43:55 +02:00
Use correct phrases for the resold gifts.
This commit is contained in:
parent
80fc58f83e
commit
3375ff6152
2 changed files with 80 additions and 30 deletions
|
@ -479,14 +479,16 @@ void BuyResaleGift(
|
|||
not_null<PeerData*> to,
|
||||
std::shared_ptr<Data::UniqueGift> gift,
|
||||
Fn<void(Payments::CheckoutResult)> done) {
|
||||
Expects(to->isUser());
|
||||
|
||||
auto formDone = [=](
|
||||
Payments::CheckoutResult result,
|
||||
const MTPUpdates *updates) {
|
||||
done(result);
|
||||
if (result == Payments::CheckoutResult::Paid) {
|
||||
AssertIsDebug(Refresh owners gifts list, refresh self list);
|
||||
gift->starsForResale = 0;
|
||||
to->owner().notifyGiftUpdate({
|
||||
.slug = gift->slug,
|
||||
.action = Data::GiftUpdate::Action::ResaleChange,
|
||||
});
|
||||
Ui::ShowResaleGiftBoughtToast(show, to, *gift);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -5611,6 +5611,11 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) {
|
|||
const MTPDmessageActionStarGiftUnique &action) {
|
||||
auto result = PreparedServiceText();
|
||||
const auto isSelf = _from->isSelf();
|
||||
const auto resaleStars = action.vresale_stars().value_or_empty();
|
||||
const auto resaleCost = TextWithEntities{ resaleStars
|
||||
? tr::lng_action_gift_for_stars(tr::now, lt_count, resaleStars)
|
||||
: QString()
|
||||
};
|
||||
const auto giftPeer = action.vpeer()
|
||||
? peerFromMTP(*action.vpeer())
|
||||
: PeerId();
|
||||
|
@ -5626,7 +5631,20 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) {
|
|||
peerToChannel(giftPeer));
|
||||
if (!from->isServiceUser() && !from->isSelf()) {
|
||||
result.links.push_back(from->createOpenLink());
|
||||
result.text = (action.is_upgrade()
|
||||
if (resaleStars) {
|
||||
result.links.push_back(channel->createOpenLink());
|
||||
}
|
||||
result.text = resaleStars
|
||||
? tr::lng_action_gift_sent_channel(
|
||||
tr::now,
|
||||
lt_user,
|
||||
Ui::Text::Link(from->shortName(), 1),
|
||||
lt_name,
|
||||
Ui::Text::Link(channel->name(), 2),
|
||||
lt_cost,
|
||||
resaleCost,
|
||||
Ui::Text::WithEntities)
|
||||
: (action.is_upgrade()
|
||||
? tr::lng_action_gift_upgraded_channel
|
||||
: tr::lng_action_gift_transferred_channel)(
|
||||
tr::now,
|
||||
|
@ -5636,7 +5654,15 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) {
|
|||
Ui::Text::Link(channel->name(), 2),
|
||||
Ui::Text::WithEntities);
|
||||
} else {
|
||||
result.text = (from->isServiceUser()
|
||||
result.text = resaleStars
|
||||
? tr::lng_action_gift_sent_self_channel(
|
||||
tr::now,
|
||||
lt_name,
|
||||
Ui::Text::Link(channel->name(), 1),
|
||||
lt_cost,
|
||||
resaleCost,
|
||||
Ui::Text::WithEntities)
|
||||
: (from->isServiceUser()
|
||||
? tr::lng_action_gift_transferred_unknown_channel
|
||||
: action.is_upgrade()
|
||||
? tr::lng_action_gift_upgraded_self_channel
|
||||
|
@ -5649,8 +5675,24 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) {
|
|||
result.links.push_back(channel->createOpenLink());
|
||||
} else {
|
||||
if (!from->isServiceUser() && !_history->peer->isSelf()) {
|
||||
if (!resaleStars || !isSelf) {
|
||||
result.links.push_back(from->createOpenLink());
|
||||
result.text = (action.is_upgrade()
|
||||
}
|
||||
result.text = resaleStars
|
||||
? (isSelf
|
||||
? tr::lng_action_gift_sent(
|
||||
tr::now,
|
||||
lt_cost,
|
||||
resaleCost,
|
||||
Ui::Text::WithEntities)
|
||||
: tr::lng_action_gift_received(
|
||||
tr::now,
|
||||
lt_user,
|
||||
Ui::Text::Link(peer->shortName(), 1), // Link 1.
|
||||
lt_cost,
|
||||
resaleCost,
|
||||
Ui::Text::WithEntities))
|
||||
: (action.is_upgrade()
|
||||
? (isSelf
|
||||
? tr::lng_action_gift_upgraded_mine
|
||||
: tr::lng_action_gift_upgraded)
|
||||
|
@ -5659,10 +5701,16 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) {
|
|||
: tr::lng_action_gift_transferred))(
|
||||
tr::now,
|
||||
lt_user,
|
||||
Ui::Text::Link(from->shortName(), 1), // Link 1.
|
||||
Ui::Text::Link(from->shortName(), 1),
|
||||
Ui::Text::WithEntities);
|
||||
} else {
|
||||
result.text = (from->isServiceUser()
|
||||
result.text = resaleStars
|
||||
? tr::lng_action_gift_self_bought(
|
||||
tr::now,
|
||||
lt_cost,
|
||||
resaleCost,
|
||||
Ui::Text::WithEntities)
|
||||
: (from->isServiceUser()
|
||||
? tr::lng_action_gift_transferred_unknown
|
||||
: action.is_upgrade()
|
||||
? tr::lng_action_gift_upgraded_self
|
||||
|
|
Loading…
Add table
Reference in a new issue