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,
|
not_null<PeerData*> to,
|
||||||
std::shared_ptr<Data::UniqueGift> gift,
|
std::shared_ptr<Data::UniqueGift> gift,
|
||||||
Fn<void(Payments::CheckoutResult)> done) {
|
Fn<void(Payments::CheckoutResult)> done) {
|
||||||
Expects(to->isUser());
|
|
||||||
|
|
||||||
auto formDone = [=](
|
auto formDone = [=](
|
||||||
Payments::CheckoutResult result,
|
Payments::CheckoutResult result,
|
||||||
const MTPUpdates *updates) {
|
const MTPUpdates *updates) {
|
||||||
done(result);
|
done(result);
|
||||||
if (result == Payments::CheckoutResult::Paid) {
|
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);
|
Ui::ShowResaleGiftBoughtToast(show, to, *gift);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -5611,6 +5611,11 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) {
|
||||||
const MTPDmessageActionStarGiftUnique &action) {
|
const MTPDmessageActionStarGiftUnique &action) {
|
||||||
auto result = PreparedServiceText();
|
auto result = PreparedServiceText();
|
||||||
const auto isSelf = _from->isSelf();
|
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()
|
const auto giftPeer = action.vpeer()
|
||||||
? peerFromMTP(*action.vpeer())
|
? peerFromMTP(*action.vpeer())
|
||||||
: PeerId();
|
: PeerId();
|
||||||
|
@ -5626,49 +5631,92 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) {
|
||||||
peerToChannel(giftPeer));
|
peerToChannel(giftPeer));
|
||||||
if (!from->isServiceUser() && !from->isSelf()) {
|
if (!from->isServiceUser() && !from->isSelf()) {
|
||||||
result.links.push_back(from->createOpenLink());
|
result.links.push_back(from->createOpenLink());
|
||||||
result.text = (action.is_upgrade()
|
if (resaleStars) {
|
||||||
? tr::lng_action_gift_upgraded_channel
|
result.links.push_back(channel->createOpenLink());
|
||||||
: tr::lng_action_gift_transferred_channel)(
|
}
|
||||||
|
result.text = resaleStars
|
||||||
|
? tr::lng_action_gift_sent_channel(
|
||||||
tr::now,
|
tr::now,
|
||||||
lt_user,
|
lt_user,
|
||||||
Ui::Text::Link(from->shortName(), 1),
|
Ui::Text::Link(from->shortName(), 1),
|
||||||
lt_channel,
|
lt_name,
|
||||||
Ui::Text::Link(channel->name(), 2),
|
Ui::Text::Link(channel->name(), 2),
|
||||||
Ui::Text::WithEntities);
|
lt_cost,
|
||||||
|
resaleCost,
|
||||||
|
Ui::Text::WithEntities)
|
||||||
|
: (action.is_upgrade()
|
||||||
|
? tr::lng_action_gift_upgraded_channel
|
||||||
|
: tr::lng_action_gift_transferred_channel)(
|
||||||
|
tr::now,
|
||||||
|
lt_user,
|
||||||
|
Ui::Text::Link(from->shortName(), 1),
|
||||||
|
lt_channel,
|
||||||
|
Ui::Text::Link(channel->name(), 2),
|
||||||
|
Ui::Text::WithEntities);
|
||||||
} else {
|
} else {
|
||||||
result.text = (from->isServiceUser()
|
result.text = resaleStars
|
||||||
? tr::lng_action_gift_transferred_unknown_channel
|
? tr::lng_action_gift_sent_self_channel(
|
||||||
: action.is_upgrade()
|
|
||||||
? tr::lng_action_gift_upgraded_self_channel
|
|
||||||
: tr::lng_action_gift_transferred_self_channel)(
|
|
||||||
tr::now,
|
tr::now,
|
||||||
lt_channel,
|
lt_name,
|
||||||
Ui::Text::Link(channel->name(), 1),
|
Ui::Text::Link(channel->name(), 1),
|
||||||
Ui::Text::WithEntities);
|
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
|
||||||
|
: tr::lng_action_gift_transferred_self_channel)(
|
||||||
|
tr::now,
|
||||||
|
lt_channel,
|
||||||
|
Ui::Text::Link(channel->name(), 1),
|
||||||
|
Ui::Text::WithEntities);
|
||||||
}
|
}
|
||||||
result.links.push_back(channel->createOpenLink());
|
result.links.push_back(channel->createOpenLink());
|
||||||
} else {
|
} else {
|
||||||
if (!from->isServiceUser() && !_history->peer->isSelf()) {
|
if (!from->isServiceUser() && !_history->peer->isSelf()) {
|
||||||
result.links.push_back(from->createOpenLink());
|
if (!resaleStars || !isSelf) {
|
||||||
result.text = (action.is_upgrade()
|
result.links.push_back(from->createOpenLink());
|
||||||
|
}
|
||||||
|
result.text = resaleStars
|
||||||
? (isSelf
|
? (isSelf
|
||||||
? tr::lng_action_gift_upgraded_mine
|
? tr::lng_action_gift_sent(
|
||||||
: tr::lng_action_gift_upgraded)
|
tr::now,
|
||||||
: (isSelf
|
lt_cost,
|
||||||
? tr::lng_action_gift_transferred_mine
|
resaleCost,
|
||||||
: tr::lng_action_gift_transferred))(
|
Ui::Text::WithEntities)
|
||||||
|
: tr::lng_action_gift_received(
|
||||||
tr::now,
|
tr::now,
|
||||||
lt_user,
|
lt_user,
|
||||||
Ui::Text::Link(from->shortName(), 1), // Link 1.
|
Ui::Text::Link(peer->shortName(), 1), // Link 1.
|
||||||
Ui::Text::WithEntities);
|
lt_cost,
|
||||||
|
resaleCost,
|
||||||
|
Ui::Text::WithEntities))
|
||||||
|
: (action.is_upgrade()
|
||||||
|
? (isSelf
|
||||||
|
? tr::lng_action_gift_upgraded_mine
|
||||||
|
: tr::lng_action_gift_upgraded)
|
||||||
|
: (isSelf
|
||||||
|
? tr::lng_action_gift_transferred_mine
|
||||||
|
: tr::lng_action_gift_transferred))(
|
||||||
|
tr::now,
|
||||||
|
lt_user,
|
||||||
|
Ui::Text::Link(from->shortName(), 1),
|
||||||
|
Ui::Text::WithEntities);
|
||||||
} else {
|
} else {
|
||||||
result.text = (from->isServiceUser()
|
result.text = resaleStars
|
||||||
? tr::lng_action_gift_transferred_unknown
|
? tr::lng_action_gift_self_bought(
|
||||||
: action.is_upgrade()
|
|
||||||
? tr::lng_action_gift_upgraded_self
|
|
||||||
: tr::lng_action_gift_transferred_self)(
|
|
||||||
tr::now,
|
tr::now,
|
||||||
Ui::Text::WithEntities);
|
lt_cost,
|
||||||
|
resaleCost,
|
||||||
|
Ui::Text::WithEntities)
|
||||||
|
: (from->isServiceUser()
|
||||||
|
? tr::lng_action_gift_transferred_unknown
|
||||||
|
: action.is_upgrade()
|
||||||
|
? tr::lng_action_gift_upgraded_self
|
||||||
|
: tr::lng_action_gift_transferred_self)(
|
||||||
|
tr::now,
|
||||||
|
Ui::Text::WithEntities);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Add table
Reference in a new issue