mirror of
https://github.com/zulip/zulip.git
synced 2025-11-09 08:26:11 +00:00
settings_ui: Fix type and $ prefix of status_element argument.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Anders Kaseorg
parent
ba97611a8b
commit
eb6ac7bd98
@@ -57,10 +57,10 @@ function rerender_ui() {
|
||||
}
|
||||
}
|
||||
|
||||
function change_notification_setting(setting, value, status_element) {
|
||||
function change_notification_setting(setting, value, $status_element) {
|
||||
const data = {};
|
||||
data[setting] = value;
|
||||
settings_ui.do_settings_change(channel.patch, "/json/settings", data, status_element);
|
||||
settings_ui.do_settings_change(channel.patch, "/json/settings", data, $status_element);
|
||||
}
|
||||
|
||||
function update_desktop_icon_count_display(settings_panel) {
|
||||
|
||||
@@ -35,7 +35,7 @@ export function do_settings_change(
|
||||
request_method: AjaxRequestHandler,
|
||||
url: string,
|
||||
data: Parameters<AjaxRequestHandler>[0]["data"],
|
||||
status_element: string,
|
||||
$status_element: JQuery,
|
||||
{
|
||||
success_msg_html = strings.success_html,
|
||||
failure_msg_html = strings.failure_html,
|
||||
@@ -45,7 +45,7 @@ export function do_settings_change(
|
||||
$error_msg_element,
|
||||
}: RequestOpts = {},
|
||||
): void {
|
||||
const $spinner = $(status_element).expectOne();
|
||||
const $spinner = $status_element.expectOne();
|
||||
$spinner.fadeTo(0, 1);
|
||||
loading.make_indicator($spinner, {text: strings.saving});
|
||||
const remove_after = sticky ? undefined : 1000;
|
||||
|
||||
@@ -324,7 +324,7 @@ export function stream_setting_changed(e, from_notification_settings) {
|
||||
}
|
||||
|
||||
const sub = get_sub_for_target(e.target);
|
||||
const status_element = from_notification_settings
|
||||
const $status_element = from_notification_settings
|
||||
? $(e.target).closest(".subsection-parent").find(".alert-notification")
|
||||
: $(`#stream_change_property_status${CSS.escape(sub.stream_id)}`);
|
||||
const setting = e.target.name;
|
||||
@@ -336,7 +336,7 @@ export function stream_setting_changed(e, from_notification_settings) {
|
||||
sub[setting] =
|
||||
user_settings[settings_config.generalize_stream_notification_setting[setting]];
|
||||
}
|
||||
stream_settings_api.set_stream_property(sub, setting, e.target.checked, status_element);
|
||||
stream_settings_api.set_stream_property(sub, setting, e.target.checked, $status_element);
|
||||
}
|
||||
|
||||
export function archive_stream(stream_id, $alert_element, $stream_row) {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import * as channel from "./channel";
|
||||
import * as settings_ui from "./settings_ui";
|
||||
|
||||
export function bulk_set_stream_property(sub_data, status_element) {
|
||||
export function bulk_set_stream_property(sub_data, $status_element) {
|
||||
const url = "/json/users/me/subscriptions/properties";
|
||||
const data = {subscription_data: JSON.stringify(sub_data)};
|
||||
if (!status_element) {
|
||||
if (!$status_element) {
|
||||
return channel.post({
|
||||
url,
|
||||
data,
|
||||
@@ -12,11 +12,11 @@ export function bulk_set_stream_property(sub_data, status_element) {
|
||||
});
|
||||
}
|
||||
|
||||
settings_ui.do_settings_change(channel.post, url, data, status_element);
|
||||
settings_ui.do_settings_change(channel.post, url, data, $status_element);
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function set_stream_property(sub, property, value, status_element) {
|
||||
export function set_stream_property(sub, property, value, $status_element) {
|
||||
const sub_data = {stream_id: sub.stream_id, property, value};
|
||||
bulk_set_stream_property([sub_data], status_element);
|
||||
bulk_set_stream_property([sub_data], $status_element);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import $ from "jquery";
|
||||
import {z} from "zod";
|
||||
|
||||
import render_topic_muted from "../templates/topic_muted.hbs";
|
||||
@@ -125,7 +124,7 @@ export function set_user_topic_visibility_policy(
|
||||
visibility_policy: number,
|
||||
from_hotkey?: boolean,
|
||||
from_banner?: boolean,
|
||||
status_element?: JQuery,
|
||||
$status_element?: JQuery,
|
||||
): void {
|
||||
const data = {
|
||||
stream_id,
|
||||
@@ -134,8 +133,8 @@ export function set_user_topic_visibility_policy(
|
||||
};
|
||||
|
||||
let $spinner: JQuery;
|
||||
if (status_element) {
|
||||
$spinner = $(status_element).expectOne();
|
||||
if ($status_element) {
|
||||
$spinner = $status_element.expectOne();
|
||||
$spinner.fadeTo(0, 1);
|
||||
loading.make_indicator($spinner, {text: settings_ui.strings.saving});
|
||||
}
|
||||
@@ -144,7 +143,7 @@ export function set_user_topic_visibility_policy(
|
||||
url: "/json/user_topics",
|
||||
data,
|
||||
success() {
|
||||
if (status_element) {
|
||||
if ($status_element) {
|
||||
const remove_after = 1000;
|
||||
const appear_after = 500;
|
||||
setTimeout(() => {
|
||||
|
||||
Reference in New Issue
Block a user