2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Fixed expiration date of boosts in boosts list.

This commit is contained in:
23rd
2023-11-08 23:54:52 +03:00
parent 282c076931
commit 33cf9a0702
4 changed files with 10 additions and 14 deletions

View File

@@ -365,15 +365,11 @@ void InnerWidget::fill() {
} else if (boost.userId) {
const auto user = _peer->owner().user(boost.userId);
if (boost.isGift || boost.isGiveaway) {
constexpr auto kMonthsDivider = int(30 * 86400);
const auto date = TimeId(boost.date.toSecsSinceEpoch());
const auto months = (boost.expiresAt - date)
/ kMonthsDivider;
const auto d = Api::GiftCode{
.from = _peer->id,
.to = user->id,
.date = date,
.months = int(months),
.date = TimeId(boost.date.toSecsSinceEpoch()),
.months = boost.expiresAfterMonths,
};
_show->showBox(Box(GiftCodePendingBox, _controller, d));
} else {

View File

@@ -391,19 +391,16 @@ BoostRow::BoostRow(const Data::Boost &boost)
void BoostRow::init() {
invalidateBadges();
constexpr auto kMonthsDivider = int(30 * 86400);
const auto months = (_boost.expiresAt - _boost.date.toSecsSinceEpoch())
/ kMonthsDivider;
auto status = !PeerListRow::special()
? tr::lng_boosts_list_status(
tr::now,
lt_date,
langDateTime(_boost.date))
: tr::lng_months_tiny(tr::now, lt_count, months)
langDayOfMonth(_boost.expiresAt.date()))
: tr::lng_months_tiny(tr::now, lt_count, _boost.expiresAfterMonths)
+ ' '
+ QChar(0x2022)
+ ' '
+ langDateTime(_boost.date);
+ langDayOfMonth(_boost.date.date());
PeerListRow::setCustomStatus(std::move(status));
}