mirror of
https://github.com/zulip/zulip.git
synced 2025-11-08 07:52:19 +00:00
message_edit: Show modal if user cannot resolve topics.
We show a modal if user is not allowed to resolve or unresolve topics due to time limit. The modal just contains the text mentioning user cannot resolve topic without stating the count of messages that are within the time limit as we do not recommend partial resolving of topics. This commit does not include any changes for resolving or unresolving topic using "Move topic" or "Move message" modals, as we will still consider them as simple topic move and show the same modal that is shown in general for moving message.
This commit is contained in:
@@ -455,3 +455,25 @@ export function get_full_datetime(time: Date): string {
|
||||
|
||||
return $t({defaultMessage: "{date} at {time}"}, {date: date_string, time: time_string});
|
||||
}
|
||||
|
||||
type TimeLimitSetting = {
|
||||
value: number;
|
||||
unit: string;
|
||||
};
|
||||
|
||||
export function get_time_limit_setting_in_appropriate_unit(
|
||||
time_limit_in_seconds: number,
|
||||
): TimeLimitSetting {
|
||||
const time_limit_in_minutes = Math.floor(time_limit_in_seconds / 60);
|
||||
if (time_limit_in_minutes < 60) {
|
||||
return {value: time_limit_in_minutes, unit: "minute"};
|
||||
}
|
||||
|
||||
const time_limit_in_hours = Math.floor(time_limit_in_minutes / 60);
|
||||
if (time_limit_in_hours < 24) {
|
||||
return {value: time_limit_in_hours, unit: "hour"};
|
||||
}
|
||||
|
||||
const time_limit_in_days = Math.floor(time_limit_in_hours / 24);
|
||||
return {value: time_limit_in_days, unit: "day"};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user