mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-14 13:17:08 +02:00
Add message link to channel star transaction info.
This commit is contained in:
parent
e1b33fbc40
commit
a333615e53
6 changed files with 15 additions and 3 deletions
|
@ -2467,6 +2467,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"lng_credits_box_history_entry_success_date" = "Transaction date";
|
||||
"lng_credits_box_history_entry_success_url" = "Transaction link";
|
||||
"lng_credits_box_history_entry_media" = "Media";
|
||||
"lng_credits_box_history_entry_message" = "Message";
|
||||
"lng_credits_box_history_entry_about" = "You can dispute this transaction {link}.";
|
||||
"lng_credits_box_history_entry_about_link" = "here";
|
||||
"lng_credits_box_history_entry_reaction_name" = "Star Reaction";
|
||||
|
|
|
@ -73,7 +73,9 @@ constexpr auto kTransactionsLimit = 100;
|
|||
return PeerId(0);
|
||||
}).value;
|
||||
const auto stargift = tl.data().vstargift();
|
||||
const auto reaction = tl.data().is_reaction();
|
||||
const auto incoming = (int64(tl.data().vstars().v) >= 0);
|
||||
const auto saveActorId = (reaction || !extended.empty()) && incoming;
|
||||
return Data::CreditsHistoryEntry{
|
||||
.id = qs(tl.data().vid()),
|
||||
.title = qs(tl.data().vtitle().value_or_empty()),
|
||||
|
@ -83,12 +85,13 @@ constexpr auto kTransactionsLimit = 100;
|
|||
.extended = std::move(extended),
|
||||
.credits = tl.data().vstars().v,
|
||||
.bareMsgId = uint64(tl.data().vmsg_id().value_or_empty()),
|
||||
.barePeerId = barePeerId,
|
||||
.barePeerId = saveActorId ? peer->id.value : barePeerId,
|
||||
.bareGiveawayMsgId = uint64(
|
||||
tl.data().vgiveaway_post_id().value_or_empty()),
|
||||
.bareGiftStickerId = (stargift
|
||||
? owner->processDocument(stargift->data().vsticker())->id
|
||||
: 0),
|
||||
.bareActorId = saveActorId ? barePeerId : uint64(0),
|
||||
.peerType = tl.data().vpeer().match([](const HistoryPeerTL &) {
|
||||
return Data::CreditsHistoryEntry::PeerType::Peer;
|
||||
}, [](const MTPDstarsTransactionPeerPlayMarket &) {
|
||||
|
|
|
@ -1168,7 +1168,9 @@ void AddCreditsHistoryEntryTable(
|
|||
});
|
||||
AddTableRow(
|
||||
table,
|
||||
tr::lng_credits_box_history_entry_media(),
|
||||
(entry.reaction
|
||||
? tr::lng_credits_box_history_entry_message
|
||||
: tr::lng_credits_box_history_entry_media)(),
|
||||
std::move(label),
|
||||
st::giveawayGiftCodeValueMargin);
|
||||
}
|
||||
|
|
|
@ -62,6 +62,7 @@ struct CreditsHistoryEntry final {
|
|||
uint64 barePeerId = 0;
|
||||
uint64 bareGiveawayMsgId = 0;
|
||||
uint64 bareGiftStickerId = 0;
|
||||
uint64 bareActorId = 0;
|
||||
PeerType peerType;
|
||||
QDateTime subscriptionUntil;
|
||||
QDateTime successDate;
|
||||
|
|
|
@ -1080,7 +1080,10 @@ void CreditsController::applySlice(const Data::CreditsStatusSlice &slice) {
|
|||
delegate()->peerListUpdateRow(row);
|
||||
},
|
||||
};
|
||||
if (const auto peerId = PeerId(i.barePeerId + s.barePeerId)) {
|
||||
if (i.bareActorId) {
|
||||
const auto peer = session().data().peer(PeerId(i.bareActorId));
|
||||
return std::make_unique<CreditsRow>(peer, descriptor);
|
||||
} else if (const auto peerId = PeerId(i.barePeerId + s.barePeerId)) {
|
||||
const auto peer = session().data().peer(peerId);
|
||||
return std::make_unique<CreditsRow>(peer, descriptor);
|
||||
} else {
|
||||
|
|
|
@ -786,6 +786,8 @@ void ReceiptCreditsBox(
|
|||
? session->data().peer(PeerId(s.barePeerId)).get()
|
||||
: (e.peerType == Type::PremiumBot)
|
||||
? nullptr
|
||||
: e.bareActorId
|
||||
? session->data().peer(PeerId(e.bareActorId)).get()
|
||||
: e.barePeerId
|
||||
? session->data().peer(PeerId(e.barePeerId)).get()
|
||||
: nullptr;
|
||||
|
|
Loading…
Add table
Reference in a new issue