Record bareMsgId in CreditsHistoryEntry.

This commit is contained in:
John Preston 2024-06-20 13:33:15 +04:00
parent 968d036834
commit 5fdaa6b91f
6 changed files with 12 additions and 9 deletions

View file

@ -43,7 +43,8 @@ constexpr auto kTransactionsLimit = 100;
.date = base::unixtime::parse(tl.data().vdate().v),
.photoId = photo ? photo->id : 0,
.credits = tl.data().vstars().v,
.bareId = barePeerId,
.bareMsgId = uint64(tl.data().vmsg_id().value_or_empty()),
.barePeerId = barePeerId,
.peerType = tl.data().vpeer().match([](const HistoryPeerTL &) {
return Data::CreditsHistoryEntry::PeerType::Peer;
}, [](const MTPDstarsTransactionPeerPlayMarket &) {

View file

@ -1646,12 +1646,12 @@ void AddCreditsHistoryEntryTable(
container,
st::giveawayGiftCodeTable),
st::giveawayGiftCodeTableMargin);
if (entry.bareId) {
if (entry.barePeerId) {
AddTableRow(
table,
tr::lng_credits_box_history_entry_peer(),
controller,
PeerId(entry.bareId));
PeerId(entry.barePeerId));
}
using Type = Data::CreditsHistoryEntry::PeerType;
if (entry.peerType == Type::AppStore) {

View file

@ -35,7 +35,8 @@ struct CreditsHistoryEntry final {
QDateTime date;
PhotoId photoId = 0;
uint64 credits = 0;
uint64 bareId = 0;
uint64 bareMsgId = 0;
uint64 barePeerId = 0;
PeerType peerType;
bool refunded = false;
bool pending = false;

View file

@ -938,8 +938,8 @@ void CreditsController::applySlice(const Data::CreditsStatusSlice &slice) {
},
};
using Type = Data::CreditsHistoryEntry::PeerType;
if (item.bareId) {
const auto peer = session().data().peer(PeerId(item.bareId));
if (const auto peerId = PeerId(item.barePeerId)) {
const auto peer = session().data().peer(peerId);
return std::make_unique<CreditsRow>(peer, descriptor);
} else if (item.peerType == Type::PremiumBot) {
return std::make_unique<CreditsRow>(_premiumBot, descriptor);

View file

@ -105,7 +105,8 @@ Fn<void(NonPanelPaymentForm)> ProcessNonPanelPaymentFormFactory(
.date = base::unixtime::parse(receipt->date),
.photoId = receipt->photo ? receipt->photo->id : 0,
.credits = receipt->credits,
.bareId = receipt->peerId.value,
.bareMsgId = uint64(),
.barePeerId = receipt->peerId.value,
.peerType = Data::CreditsHistoryEntry::PeerType::Peer,
};
controller->uiShow()->show(Box(

View file

@ -336,8 +336,8 @@ void ReceiptCreditsBox(
const auto &stUser = st::boostReplaceUserpic;
const auto peer = (e.peerType == Type::PremiumBot)
? premiumBot
: e.bareId
? controller->session().data().peer(PeerId(e.bareId)).get()
: e.barePeerId
? controller->session().data().peer(PeerId(e.barePeerId)).get()
: nullptr;
const auto photo = e.photoId
? controller->session().data().photo(e.photoId).get()