settings: Add UI for realm-level default of enter_sends settings.

This commit is contained in:
Sahil Batra 2021-09-17 16:21:31 +05:30 committed by Tim Abbott
parent 22ec3c7993
commit ba1fe77996
4 changed files with 25 additions and 0 deletions

View File

@ -411,6 +411,7 @@ export const realm_user_settings_defaults_labels = {
}),
realm_presence_enabled: $t({defaultMessage: "Display availability to other users when online"}),
realm_enter_sends: $t({defaultMessage: "Enter sends when composing a message"}),
};
// NOTIFICATIONS

View File

@ -36,5 +36,18 @@ export function set_up() {
);
});
container.find(".enter_sends").on("change", (e) => {
e.preventDefault();
e.stopPropagation();
const data = {enter_sends: container.find(".enter_sends").prop("checked")};
settings_ui.do_settings_change(
channel.patch,
"/json/realm/user_settings_defaults",
data,
container.find(".other-setting-status").expectOne(),
);
});
maybe_disable_widgets();
}

View File

@ -16,4 +16,14 @@
help_link="/help/status-and-availability"
prefix="realm_"}}
</div>
<div class="form-horizontal" class="other_settings">
<h3 class="inline-block">{{t "Other settings" }}</h3>
<div class="alert-notification other-setting-status"></div>
{{> settings_checkbox
setting_name="enter_sends"
is_checked=settings_object.enter_sends
label=settings_label.realm_enter_sends
prefix="realm_"}}
</div>
</div>

View File

@ -118,6 +118,7 @@ IGNORED_PHRASES = [
# SPECIAL CASES
# Enter is usually capitalized
r"Press Enter to send",
r"Send message on pressing Enter",
# Because topics usually are lower-case, this would look weird if it were capitalized
r"more topics",
# For consistency with "more topics"