mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-14 13:17:08 +02:00
Slightly improved process of incoming credit history entries.
This commit is contained in:
parent
101dbdf243
commit
21094fe11b
1 changed files with 11 additions and 1 deletions
|
@ -36,6 +36,16 @@ constexpr auto kTransactionsLimit = 100;
|
|||
}, [](const auto &) {
|
||||
return PeerId(0);
|
||||
}).value;
|
||||
const auto isBot = [&] {
|
||||
if (barePeerId) {
|
||||
if (const auto p = peer->owner().peer(PeerId(barePeerId))) {
|
||||
if (const auto u = p->asUser()) {
|
||||
return u->isBot();
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}();
|
||||
return Data::CreditsHistoryEntry{
|
||||
.id = qs(tl.data().vid()),
|
||||
.title = qs(tl.data().vtitle().value_or_empty()),
|
||||
|
@ -65,7 +75,7 @@ constexpr auto kTransactionsLimit = 100;
|
|||
? base::unixtime::parse(tl.data().vtransaction_date()->v)
|
||||
: QDateTime(),
|
||||
.finishUrl = qs(tl.data().vtransaction_url().value_or_empty()),
|
||||
.in = (!barePeerId || tl.data().is_refund())
|
||||
.in = (!isBot || tl.data().is_refund())
|
||||
&& !tl.data().is_pending()
|
||||
&& !tl.data().is_failed(),
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue