settings: Fix custom input handling of message retention setting.

This commit adds code to convert $custom_input.val() to Number
in get_message_retention_setting_value such that values like
"48aa" are treated as NaN and we correctly show save-discard
widget with save button disabled. If we not convert it to Number,
Number.parseInt will just convert "48aa" to 48.

This commit is similar to 711536f53a.
This commit is contained in:
Sahil Batra 2023-01-20 13:50:29 +05:30 committed by Tim Abbott
parent 235bd3fb1b
commit 82aacb4996
1 changed files with 1 additions and 1 deletions

View File

@ -379,7 +379,7 @@ function get_message_retention_setting_value($input_elem, for_api_data = true) {
if ($custom_input.val().length === 0) {
return settings_config.retain_message_forever;
}
return Number.parseInt($custom_input.val(), 10);
return Number.parseInt(Number($custom_input.val()), 10);
}
function get_dropdown_value_for_message_retention_setting(setting_value) {