Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

eslint: Fix unicorn/no-late-current-target-access.

Anders Kaseorg474b47ffcba8
diff --git a/web/src/personal_menu_popover.ts b/web/src/personal_menu_popover.ts
index d7b2159f338..f45006cc8e1 100644
--- a/web/src/personal_menu_popover.ts
+++ b/web/src/personal_menu_popover.ts
@@ -36,18 +36,18 @@ export function initialize(): void {
const $popper = $(instance.popper);
popover_menus.popover_instances.personal_menu = instance;
- $popper.on("change", "input[name='theme-select']", (e) => {
- const new_theme_code = $(e.currentTarget).attr("data-theme-code");
+ $popper.on("change", "input[name='theme-select']", function () {
+ const new_theme_code = $(this).attr("data-theme-code");
channel.patch({
url: "/json/settings",
data: {color_scheme: new_theme_code},
- error() {
+ error: () => {
// NOTE: The additional delay allows us to visually communicate
// that an error occurred due to which we are reverting back
// to the previously used value.
setTimeout(() => {
const prev_theme_code = user_settings.color_scheme;
- $(e.currentTarget)
+ $(this)
.parent()
.find(`input[data-theme-code="${prev_theme_code}"]`)
.prop("checked", true);
diff --git a/web/src/settings_bots.ts b/web/src/settings_bots.ts
index 1bff3e00a85..858f1ff69f1 100644
--- a/web/src/settings_bots.ts
+++ b/web/src/settings_bots.ts
@@ -742,11 +742,11 @@ function set_up_bot_handlers($container: JQuery): void {
add_a_new_bot();
});
- $container.find(".download-botserverrc-file").on("click", (e) => {
+ $container.find(".download-botserverrc-file").on("click", function () {
void (async () => {
let content = "";
- buttons.show_button_loading_indicator($(e.currentTarget));
- $(e.currentTarget).prop("disabled", true);
+ buttons.show_button_loading_indicator($(this));
+ $(this).prop("disabled", true);
for (const bot of bot_data.get_all_bots_for_current_user()) {
if (bot.is_active && bot.bot_type === OUTGOING_WEBHOOK_BOT_TYPE_INT) {
const bot_token = bot_helper.get_outgoing_webhook_token(bot.user_id);
@@ -755,15 +755,15 @@ function set_up_bot_handlers($container: JQuery): void {
$("#admin-your-bots-list .bot-list-error"),
);
if (!api_key) {
- buttons.hide_button_loading_indicator($(e.currentTarget));
- $(e.currentTarget).prop("disabled", false);
+ buttons.hide_button_loading_indicator($(this));
+ $(this).prop("disabled", false);
return;
}
content += generate_botserverrc_content(bot.email, api_key, bot_token);
}
}
- buttons.hide_button_loading_indicator($(e.currentTarget));
- $(e.currentTarget).prop("disabled", false);
+ buttons.hide_button_loading_indicator($(this));
+ $(this).prop("disabled", false);
$container
.find(".hidden-botserverrc-download")
diff --git a/web/src/topic_popover.ts b/web/src/topic_popover.ts
index 5f1d17b060e..39993850c3e 100644
--- a/web/src/topic_popover.ts
+++ b/web/src/topic_popover.ts
@@ -132,10 +132,10 @@ export function initialize(): void {
popover_menus.focus_popover(instance);
- $popper.on("change", "input[name='sidebar-topic-visibility-select']", (e) => {
+ $popper.on("change", "input[name='sidebar-topic-visibility-select']", function () {
const start_time = Date.now();
const visibility_policy = Number.parseInt(
- $(e.currentTarget).attr("data-visibility-policy")!,
+ $(this).attr("data-visibility-policy")!,
10,
);
@@ -153,7 +153,7 @@ export function initialize(): void {
stream_id,
topic_name,
);
- const $prev_visibility_policy_input = $(e.currentTarget)
+ const $prev_visibility_policy_input = $(this)
.parent()
.find(`input[data-visibility-policy="${prev_visibility_policy}"]`);
setTimeout(
diff --git a/web/src/user_topic_popover.ts b/web/src/user_topic_popover.ts
index 146995cb0e6..5f13b6b91cb 100644
--- a/web/src/user_topic_popover.ts
+++ b/web/src/user_topic_popover.ts
@@ -92,11 +92,11 @@ export function initialize(): void {
popover_menus.focus_popover(instance);
- $popper.on("change", "input[name='visibility-policy-select']", (e) => {
+ $popper.on("change", "input[name='visibility-policy-select']", function () {
const start_time = Date.now();
const visibility_policy = Number.parseInt(
- $(e.currentTarget).attr("data-visibility-policy")!,
+ $(this).attr("data-visibility-policy")!,
10,
);
@@ -115,7 +115,7 @@ export function initialize(): void {
stream_id,
topic_name,
);
- const $prev_visibility_policy_input = $(e.currentTarget)
+ const $prev_visibility_policy_input = $(this)
.parent()
.find(`input[data-visibility-policy="${prev_visibility_policy}"]`);
setTimeout(