Added transaction link and date to details of credits history entries.

This commit is contained in:
23rd 2024-06-24 05:03:23 +03:00 committed by John Preston
parent d9caf15d1d
commit 0fc2df8eec
4 changed files with 19 additions and 4 deletions

View file

@ -2353,6 +2353,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_credits_box_history_entry_ads" = "Ads Platform";
"lng_credits_box_history_entry_id" = "Transaction ID";
"lng_credits_box_history_entry_id_copied" = "Transaction ID copied to clipboard.";
"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_about" = "You can dispute this transaction {link}.";
"lng_credits_box_history_entry_about_link" = "here";

View file

@ -74,10 +74,10 @@ constexpr auto kTransactionsLimit = 100;
.refunded = tl.data().is_refund(),
.pending = tl.data().is_pending(),
.failed = tl.data().is_failed(),
.finishDate = tl.data().vtransaction_date()
.successDate = tl.data().vtransaction_date()
? base::unixtime::parse(tl.data().vtransaction_date()->v)
: QDateTime(),
.finishUrl = qs(tl.data().vtransaction_url().value_or_empty()),
.successLink = qs(tl.data().vtransaction_url().value_or_empty()),
.in = (!isBot || tl.data().is_refund())
&& !tl.data().is_pending()
&& !tl.data().is_failed(),

View file

@ -1730,4 +1730,17 @@ void AddCreditsHistoryEntryTable(
tr::lng_gift_link_label_date(),
rpl::single(Ui::Text::WithEntities(langDateTime(entry.date))));
}
if (!entry.successDate.isNull()) {
AddTableRow(
table,
tr::lng_credits_box_history_entry_success_date(),
rpl::single(Ui::Text::WithEntities(langDateTime(entry.date))));
}
if (!entry.successLink.isEmpty()) {
AddTableRow(
table,
tr::lng_credits_box_history_entry_success_url(),
rpl::single(
Ui::Text::Link(entry.successLink, entry.successLink)));
}
}

View file

@ -42,8 +42,8 @@ struct CreditsHistoryEntry final {
bool refunded = false;
bool pending = false;
bool failed = false;
QDateTime finishDate;
QString finishUrl;
QDateTime successDate;
QString successLink;
bool in = false;
};