mirror of https://github.com/zulip/zulip.git
settings: Fix custom time limit input validation.
Previously, typing something like "24aa" in message edit limit custom input box would not disable the "Save changes" button and clicking on it would set the limit to 24 minutes because "24aa" was parsed to 24 by parseInt which is a valid value. We now fix this to first convert the input to number using "Number()" function and then use parseInt. "Number()" function returns NaN for input like "24a" and other inputs containing alphabet characters and thus it is considered as invalid value and "Save changes" button is disabled.
This commit is contained in:
parent
37fefb374c
commit
711536f53a
|
@ -896,7 +896,7 @@ function enable_or_disable_save_button($subsection_elem) {
|
|||
for (const setting_elem of time_limit_settings) {
|
||||
const dropdown_elem_val = $(setting_elem).find("select").val();
|
||||
const custom_input_elem_val = Number.parseInt(
|
||||
$(setting_elem).find(".admin-realm-time-limit-input").val(),
|
||||
Number($(setting_elem).find(".admin-realm-time-limit-input").val()),
|
||||
10,
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in New Issue