Slightly improved process of incoming credit history entries.

This commit is contained in:
23rd 2024-06-21 15:45:15 +03:00 committed by John Preston
parent 101dbdf243
commit 21094fe11b

View file

@ -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(),
};