stream_settings: Refactor code for stream message retention setting.

This commit refactors the code for stream message retentions setting
to match it with the other time limit settings -

- Rename the "Retain for N days after posting" option to "Custom".
We also update the option value from "retain_for_period" to
"custom_period".

- Change the label of custom input to "Retention period (days)"
as it is more descriptive and clear than just labelling it as "N".

- The custom input is also moved to be below the dropdown and
also has left margin as with the other time limit realm settings.
This commit is contained in:
Sahil Batra
2022-10-26 20:28:31 +05:30
committed by Tim Abbott
parent ec1f41eb9d
commit de259b3c4a
3 changed files with 8 additions and 8 deletions

View File

@@ -226,7 +226,7 @@ function create_stream() {
let message_retention_selection = $(
"#stream_creation_form select[name=stream_message_retention_setting]",
).val();
if (message_retention_selection === "retain_for_period") {
if (message_retention_selection === "custom_period") {
message_retention_selection = Number.parseInt(
$("#stream_creation_form input[name=stream-message-retention-days]").val(),
10,
@@ -323,7 +323,7 @@ export function show_new_stream_modal() {
// Add listener to .show stream-message-retention-days-input that we've hidden above
$("#stream_creation_form .stream_message_retention_setting").on("change", (e) => {
if (e.target.value === "retain_for_period") {
if (e.target.value === "custom_period") {
$("#stream_creation_form .stream-message-retention-days-input").show();
} else {
$("#stream_creation_form .stream-message-retention-days-input").hide();