Disallow temporary mute for more than 1 week.

GitOrigin-RevId: 7741c7f2787fde7b836d1027ccb421938ddaf317
This commit is contained in:
levlam 2019-12-29 04:26:00 +03:00
parent 104623f179
commit 24139cabab
2 changed files with 4 additions and 2 deletions

View File

@ -3540,7 +3540,8 @@ setChatPermissions chat_id:int53 permissions:chatPermissions = Ok;
//@description Changes the draft message in a chat @chat_id Chat identifier @draft_message New draft message; may be null
setChatDraftMessage chat_id:int53 draft_message:draftMessage = Ok;
//@description Changes the notification settings of a chat. Notification settings of a chat with the current user (Saved Messages) can't be changed @chat_id Chat identifier @notification_settings New notification settings for the chat
//@description Changes the notification settings of a chat. Notification settings of a chat with the current user (Saved Messages) can't be changed
//@chat_id Chat identifier @notification_settings New notification settings for the chat. If the chat is muted for more than 1 week, it is considered to be muted forever
setChatNotificationSettings chat_id:int53 notification_settings:chatNotificationSettings = Ok;
//@description Changes the pinned state of a chat. You can pin up to GetOption("pinned_chat_count_max")/GetOption("pinned_archived_chat_count_max") non-secret chats and the same number of secret chats in the main/archive chat list @chat_id Chat identifier @is_pinned New value of is_pinned

View File

@ -120,8 +120,9 @@ static int32 get_mute_until(int32 mute_for) {
return 0;
}
const int32 MAX_PRECISE_MUTE_FOR = 7 * 86400;
int32 current_time = G()->unix_time();
if (mute_for >= std::numeric_limits<int32>::max() - current_time) {
if (mute_for > MAX_PRECISE_MUTE_FOR || mute_for >= std::numeric_limits<int32>::max() - current_time) {
return std::numeric_limits<int32>::max();
}
return mute_for + current_time;