mirror of https://github.com/zulip/zulip.git
settings: Use variable for notification sound element.
This commit changes the click handler for playing notification sound to use a variable instead of directly using the element id such that we can use the same code for realm-level settings also by just setting the variable accordingly.
This commit is contained in:
parent
1252d1602b
commit
079e45c7cf
|
@ -75,6 +75,7 @@ export function set_enable_marketing_emails_visibility() {
|
||||||
|
|
||||||
export function set_up(container, settings_object) {
|
export function set_up(container, settings_object) {
|
||||||
const patch_url = "/json/settings";
|
const patch_url = "/json/settings";
|
||||||
|
const notification_sound_elem = $("#user-notification-sound-audio");
|
||||||
container.find(".notification-settings-form").on("change", "input, select", function (e) {
|
container.find(".notification-settings-form").on("change", "input, select", function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
@ -102,7 +103,7 @@ export function set_up(container, settings_object) {
|
||||||
|
|
||||||
container.find(".play_notification_sound").on("click", () => {
|
container.find(".play_notification_sound").on("click", () => {
|
||||||
if (settings_object.notification_sound !== "none") {
|
if (settings_object.notification_sound !== "none") {
|
||||||
$("#user-notification-sound-audio")[0].play();
|
notification_sound_elem[0].play();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue