mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 06:35:14 +00:00
Show restricted date to user
This commit is contained in:
@@ -750,6 +750,36 @@ std::optional<QString> RestrictionError(
|
||||
using Flag = ChatRestriction;
|
||||
if (const auto restricted = peer->amRestricted(restriction)) {
|
||||
const auto all = restricted.isWithEveryone();
|
||||
if (!all && const auto channel = peer->asChannel()) {
|
||||
auto restrictedUntil = channel->restrictedUntil();
|
||||
if (restrictedUntil > 0) {
|
||||
auto restrictedUntilDateTime = base::unixtime::parse(channel->restrictedUntil());
|
||||
auto date = restrictedUntilDateTime.toString(qsl("d.MM.yy"));
|
||||
auto time = restrictedUntilDateTime.toString(cTimeFormat());
|
||||
|
||||
switch (restriction) {
|
||||
case Flag::f_send_polls:
|
||||
return tr::ktg_restricted_send_polls_until(
|
||||
tr::now, lt_date, date, lt_time, time);
|
||||
case Flag::f_send_messages:
|
||||
return tr::ktg_restricted_send_message_until(
|
||||
tr::now, lt_date, date, lt_time, time);
|
||||
case Flag::f_send_media:
|
||||
return tr::ktg_restricted_send_media_until(
|
||||
tr::now, lt_date, date, lt_time, time);
|
||||
case Flag::f_send_stickers:
|
||||
return tr::ktg_restricted_send_stickers_until(
|
||||
tr::now, lt_date, date, lt_time, time);
|
||||
case Flag::f_send_gifs:
|
||||
return tr::ktg_restricted_send_gifs_until(
|
||||
tr::now, lt_date, date, lt_time, time);
|
||||
case Flag::f_send_inline:
|
||||
case Flag::f_send_games:
|
||||
return tr::ktg_restricted_send_inline_until(
|
||||
tr::now, lt_date, date, lt_time, time);
|
||||
}
|
||||
}
|
||||
}
|
||||
switch (restriction) {
|
||||
case Flag::f_send_polls:
|
||||
return all
|
||||
|
Reference in New Issue
Block a user