Added special status to peers in gifts list with tomorrow birthday.

This commit is contained in:
23rd 2025-04-18 19:55:32 +03:00 committed by John Preston
parent 1b78ffc018
commit 384c540197
2 changed files with 12 additions and 4 deletions

View file

@ -3458,6 +3458,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_gift_subtitle_birthdays" = "Birthdays"; "lng_gift_subtitle_birthdays" = "Birthdays";
"lng_gift_list_birthday_status_today" = "{emoji} Birthday today"; "lng_gift_list_birthday_status_today" = "{emoji} Birthday today";
"lng_gift_list_birthday_status_yesterday" = "Birthday yesterday"; "lng_gift_list_birthday_status_yesterday" = "Birthday yesterday";
"lng_gift_list_birthday_status_tomorrow" = "Birthday tomorrow";
"lng_gift_self_status" = "buy yourself a gift"; "lng_gift_self_status" = "buy yourself a gift";
"lng_gift_self_title" = "Buy a Gift"; "lng_gift_self_title" = "Buy a Gift";
"lng_gift_self_about" = "Buy yourself a gift to display on your page or reserve for later.\n\nLimited-edition gifts upgraded to collectibles can be gifted to others later."; "lng_gift_self_about" = "Buy yourself a gift to display on your page or reserve for later.\n\nLimited-edition gifts upgraded to collectibles can be gifted to others later.";

View file

@ -2558,10 +2558,17 @@ Controller::Controller(not_null<Main::Session*> session, PickCallback pick)
Data::BirthdayCake()); Data::BirthdayCake());
} }
const auto yesterday = QDate::currentDate().addDays(-1); const auto yesterday = QDate::currentDate().addDays(-1);
return (date.day() == yesterday.day() const auto tomorrow = QDate::currentDate().addDays(1);
&& date.month() == yesterday.month()) if (date.day() == yesterday.day()
? tr::lng_gift_list_birthday_status_yesterday(tr::now) && date.month() == yesterday.month()) {
: QString(); return tr::lng_gift_list_birthday_status_yesterday(
tr::now);
} else if (date.day() == tomorrow.day()
&& date.month() == tomorrow.month()) {
return tr::lng_gift_list_birthday_status_tomorrow(
tr::now);
}
return QString();
}; };
auto usersWithBirthdays = ranges::views::all( auto usersWithBirthdays = ranges::views::all(