settings_org: Rename custom_days option to custom_period.

This commit renames custom_days option for realm waiting
threshold setting dropdown to custom_period such that we
can reuse existing code for similar time-limit settings.
This commit is contained in:
Sahil Batra 2022-12-09 20:12:11 +05:30 committed by Tim Abbott
parent 235768ae4c
commit 43898be138
3 changed files with 7 additions and 7 deletions

View File

@ -162,7 +162,7 @@ async function test_set_new_user_threshold_to_three_days(page: Page): Promise<vo
async function test_set_new_user_threshold_to_N_days(page: Page): Promise<void> {
console.log("Test setting new user threshold to three days.");
await page.waitForSelector("#id_realm_waiting_period_setting", {visible: true});
await page.select("#id_realm_waiting_period_setting", "custom_days");
await page.select("#id_realm_waiting_period_setting", "custom_period");
const N = "10";
await common.clear_and_type(page, "#id_realm_waiting_period_threshold", N);

View File

@ -175,7 +175,7 @@ function get_property_value(property_name, for_realm_default_settings, sub) {
if (page_params.realm_waiting_period_threshold === 3) {
return "three_days";
}
return "custom_days";
return "custom_period";
}
if (property_name === "realm_org_join_restrictions") {
@ -250,7 +250,7 @@ function set_realm_waiting_period_dropdown() {
$("#id_realm_waiting_period_setting").val(value);
change_element_block_display_property(
"id_realm_waiting_period_threshold",
value === "custom_days",
value === "custom_period",
);
}
@ -1092,7 +1092,7 @@ export function register_save_discard_widget_handlers(
case "three_days":
data.waiting_period_threshold = 3;
break;
case "custom_days":
case "custom_period":
data.waiting_period_threshold = $(
"#id_realm_waiting_period_threshold",
).val();
@ -1194,7 +1194,7 @@ export function build_page() {
const waiting_period_threshold = this.value;
change_element_block_display_property(
"id_realm_waiting_period_threshold",
waiting_period_threshold === "custom_days",
waiting_period_threshold === "custom_period",
);
});

View File

@ -43,9 +43,9 @@
<select name="realm_waiting_period_setting" id="id_realm_waiting_period_setting" class="prop-element">
<option value="none">{{t "None" }}</option>
<option value="three_days">{{t "3 days" }}</option>
<option value="custom_days">{{t "Custom" }}</option>
<option value="custom_period">{{t "Custom" }}</option>
</select>
{{!-- This setting is hidden unless `custom_days` --}}
{{!-- This setting is hidden unless `custom_period` --}}
<div class="dependent-settings-block">
<label for="id_realm_waiting_period_threshold" class="inline-block">{{t "Waiting period (days)" }}:</label>
<input type="text" id="id_realm_waiting_period_threshold"