mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-30 22:25:12 +00:00
Show restricted date to user
This commit is contained in:
@@ -2238,4 +2238,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"ktg_pinned_message_show" = "Show pinned message";
|
||||
"ktg_pinned_message_hide" = "Hide pinned message";
|
||||
|
||||
"ktg_restricted_send_message_until" = "The admins of this group restricted you from writing here until {date}, {time}.";
|
||||
"ktg_restricted_send_media_until" = "The admins of this group restricted you from posting media content here until {date}, {time}.";
|
||||
"ktg_restricted_send_stickers_until" = "The admins of this group restricted you from posting stickers here until {date}, {time}.";
|
||||
"ktg_restricted_send_gifs_until" = "The admins of this group restricted you from posting GIFs here until {date}, {time}.";
|
||||
"ktg_restricted_send_inline_until" = "The admins of this group restricted you from posting inline content here until {date}, {time}.";
|
||||
"ktg_restricted_send_polls_until" = "The admins of this group restricted you from posting polls here until {date}, {time}.";
|
||||
|
||||
// Keys finished
|
||||
|
@@ -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