diff --git a/.eslintrc.json b/.eslintrc.json
index cb9bea23d6..c84c406591 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -70,6 +70,7 @@
"no-use-before-define": "error",
"no-useless-constructor": "error",
"no-var": "error",
+ "object-shorthand": "error",
"one-var": [ "error", "never" ],
"prefer-arrow-callback": "error",
"prefer-const": [ "error",
@@ -307,6 +308,7 @@
"rules": {
// Don’t require ES features that PhantomJS doesn’t support
"no-var": "off",
+ "object-shorthand": "off",
"prefer-arrow-callback": "off"
}
},
diff --git a/frontend_tests/node_tests/activity.js b/frontend_tests/node_tests/activity.js
index 80e927851c..e0cb3831c1 100644
--- a/frontend_tests/node_tests/activity.js
+++ b/frontend_tests/node_tests/activity.js
@@ -13,7 +13,7 @@ const _page_params = {
};
const _document = {
- hasFocus: function () {
+ hasFocus() {
return true;
},
};
@@ -41,15 +41,15 @@ const _pm_list = {
};
const _popovers = {
- hide_all_except_sidebars: function () {},
- hide_all: function () {},
- show_userlist_sidebar: function () {
+ hide_all_except_sidebars() {},
+ hide_all() {},
+ show_userlist_sidebar() {
$(".column-right").addClass("expanded");
},
};
const _stream_popover = {
- show_streamlist_sidebar: function () {
+ show_streamlist_sidebar() {
$(".column-left").addClass("expanded");
},
};
@@ -681,7 +681,7 @@ run_test("initialize", () => {
clear();
$.stub_selector("html", {
- on: function (name, func) {
+ on(name, func) {
func();
},
});
@@ -690,7 +690,7 @@ run_test("initialize", () => {
payload.success({});
};
global.server_events = {
- check_for_unsuspend: function () {},
+ check_for_unsuspend() {},
};
let scroll_handler_started;
diff --git a/frontend_tests/node_tests/buddy_data.js b/frontend_tests/node_tests/buddy_data.js
index 2c9101f5ff..7f6a08ef89 100644
--- a/frontend_tests/node_tests/buddy_data.js
+++ b/frontend_tests/node_tests/buddy_data.js
@@ -138,7 +138,7 @@ function activate_people() {
function set_presence(user_id, status) {
presence.presence_info.set(user_id, {
- status: status,
+ status,
last_active: 9999,
});
}
diff --git a/frontend_tests/node_tests/buddy_list.js b/frontend_tests/node_tests/buddy_list.js
index a9e65e363a..4aaff353ec 100644
--- a/frontend_tests/node_tests/buddy_list.js
+++ b/frontend_tests/node_tests/buddy_list.js
@@ -168,13 +168,13 @@ run_test("find_li w/force_render", () => {
};
const empty_li = buddy_list.find_li({
- key: key,
+ key,
});
assert.equal(empty_li, stub_li);
assert(!shown);
const li = buddy_list.find_li({
- key: key,
+ key,
force_render: true,
});
diff --git a/frontend_tests/node_tests/channel.js b/frontend_tests/node_tests/channel.js
index e2fdda23c9..b7435c0712 100644
--- a/frontend_tests/node_tests/channel.js
+++ b/frontend_tests/node_tests/channel.js
@@ -34,11 +34,11 @@ function test_with_mock_ajax(test_params) {
run_test("basics", () => {
test_with_mock_ajax({
- run_code: function () {
+ run_code() {
channel.post({});
},
- check_ajax_options: function (options) {
+ check_ajax_options(options) {
assert.equal(options.type, "POST");
assert.equal(options.dataType, "json");
@@ -49,11 +49,11 @@ run_test("basics", () => {
});
test_with_mock_ajax({
- run_code: function () {
+ run_code() {
channel.patch({});
},
- check_ajax_options: function (options) {
+ check_ajax_options(options) {
assert.equal(options.type, "POST");
assert.equal(options.data.method, "PATCH");
assert.equal(options.dataType, "json");
@@ -65,11 +65,11 @@ run_test("basics", () => {
});
test_with_mock_ajax({
- run_code: function () {
+ run_code() {
channel.put({});
},
- check_ajax_options: function (options) {
+ check_ajax_options(options) {
assert.equal(options.type, "PUT");
assert.equal(options.dataType, "json");
@@ -80,11 +80,11 @@ run_test("basics", () => {
});
test_with_mock_ajax({
- run_code: function () {
+ run_code() {
channel.del({});
},
- check_ajax_options: function (options) {
+ check_ajax_options(options) {
assert.equal(options.type, "DELETE");
assert.equal(options.dataType, "json");
@@ -95,11 +95,11 @@ run_test("basics", () => {
});
test_with_mock_ajax({
- run_code: function () {
+ run_code() {
channel.get({});
},
- check_ajax_options: function (options) {
+ check_ajax_options(options) {
assert.equal(options.type, "GET");
assert.equal(options.dataType, "json");
@@ -124,23 +124,23 @@ run_test("normal_post", () => {
test_with_mock_ajax({
xhr: stub_xhr,
- run_code: function () {
+ run_code() {
channel.post({
- data: data,
+ data,
url: "/json/endpoint",
- success: function (data, text_status, xhr) {
+ success(data, text_status, xhr) {
orig_success_called = true;
assert.equal(data, "response data");
assert.equal(text_status, "success");
assert.equal(xhr, stub_xhr);
},
- error: function () {
+ error() {
orig_error_called = true;
},
});
},
- check_ajax_options: function (options) {
+ check_ajax_options(options) {
assert.equal(options.type, "POST");
assert.equal(options.dataType, "json");
assert.deepEqual(options.data, data);
@@ -159,7 +159,7 @@ run_test("patch_with_form_data", () => {
let appended;
const data = {
- append: function (k, v) {
+ append(k, v) {
assert.equal(k, "method");
assert.equal(v, "PATCH");
appended = true;
@@ -167,15 +167,15 @@ run_test("patch_with_form_data", () => {
};
test_with_mock_ajax({
- run_code: function () {
+ run_code() {
channel.patch({
- data: data,
+ data,
processData: false,
});
assert(appended);
},
- check_ajax_options: function (options) {
+ check_ajax_options(options) {
assert.equal(options.type, "POST");
assert.equal(options.dataType, "json");
@@ -193,11 +193,11 @@ run_test("reload_on_403_error", () => {
responseText: '{"msg": "CSRF Fehler: etwas", "code": "CSRF_FAILED"}',
},
- run_code: function () {
+ run_code() {
channel.post({});
},
- check_ajax_options: function (options) {
+ check_ajax_options(options) {
let reload_initiated;
reload.initiate = function (options) {
reload_initiated = true;
@@ -222,11 +222,11 @@ run_test("unexpected_403_response", () => {
responseText: "unexpected",
},
- run_code: function () {
+ run_code() {
channel.post({});
},
- check_ajax_options: function (options) {
+ check_ajax_options(options) {
blueslip.expect("error", "Unexpected 403 response from server");
options.simulate_error();
},
@@ -235,14 +235,14 @@ run_test("unexpected_403_response", () => {
run_test("retry", () => {
test_with_mock_ajax({
- run_code: function () {
+ run_code() {
channel.post({
idempotent: true,
data: 42,
});
},
- check_ajax_options: function (options) {
+ check_ajax_options(options) {
global.patch_builtin("setTimeout", (f, delay) => {
assert.equal(delay, 0);
f();
@@ -250,11 +250,11 @@ run_test("retry", () => {
blueslip.expect("log", "Retrying idempotent[object Object]");
test_with_mock_ajax({
- run_code: function () {
+ run_code() {
options.simulate_success();
},
- check_ajax_options: function (options) {
+ check_ajax_options(options) {
assert.equal(options.data, 42);
},
});
diff --git a/frontend_tests/node_tests/components.js b/frontend_tests/node_tests/components.js
index 9fb28df60e..164c07ef2c 100644
--- a/frontend_tests/node_tests/components.js
+++ b/frontend_tests/node_tests/components.js
@@ -142,7 +142,7 @@ run_test("basics", () => {
{label: i18n.t("Search operators"), key: "search-operators"},
],
html_class: "stream_sorter_toggle",
- callback: function (name, key) {
+ callback(name, key) {
assert.equal(callback_args, undefined);
callback_args = [name, key];
diff --git a/frontend_tests/node_tests/compose.js b/frontend_tests/node_tests/compose.js
index f91a5f03a2..d3dd252670 100644
--- a/frontend_tests/node_tests/compose.js
+++ b/frontend_tests/node_tests/compose.js
@@ -15,10 +15,10 @@ const _navigator = {
};
const _document = {
- getElementById: function () {
+ getElementById() {
return $("#compose-textarea");
},
- execCommand: function () {
+ execCommand() {
return false;
},
location: {},
@@ -626,7 +626,7 @@ run_test("send_message", () => {
func();
});
global.server_events = {
- assert_get_events_running: function () {
+ assert_get_events_running() {
stub_state.get_events_running_called += 1;
},
};
@@ -994,7 +994,7 @@ run_test("initialize", () => {
compose_actions_start_checked = false;
global.compose_actions = {
- start: function (msg_type, opts) {
+ start(msg_type, opts) {
assert.equal(msg_type, "stream");
assert.deepEqual(opts, expected_opts);
compose_actions_start_checked = true;
@@ -1049,11 +1049,11 @@ run_test("update_fade", () => {
let update_all_called = false;
global.compose_fade = {
- set_focused_recipient: function (msg_type) {
+ set_focused_recipient(msg_type) {
assert.equal(msg_type, "private");
set_focused_recipient_checked = true;
},
- update_all: function () {
+ update_all() {
update_all_called = true;
},
};
@@ -1073,7 +1073,7 @@ run_test("trigger_submit_compose_form", () => {
let prevent_default_checked = false;
let compose_finish_checked = false;
const e = {
- preventDefault: function () {
+ preventDefault() {
prevent_default_checked = true;
},
};
@@ -1262,13 +1262,13 @@ run_test("on_events", () => {
const event = {
preventDefault: noop,
- target: target,
+ target,
};
const helper = {
- event: event,
- container: container,
- target: target,
+ event,
+ container,
+ target,
container_was_removed: () => container_removed,
};
@@ -1679,7 +1679,7 @@ run_test("create_message_object", () => {
global.$ = function (selector) {
return {
- val: function () {
+ val() {
return page[selector];
},
};
diff --git a/frontend_tests/node_tests/compose_actions.js b/frontend_tests/node_tests/compose_actions.js
index 9050ccfd44..563254c196 100644
--- a/frontend_tests/node_tests/compose_actions.js
+++ b/frontend_tests/node_tests/compose_actions.js
@@ -79,10 +79,10 @@ set_global("common", {
function stub_selected_message(msg) {
set_global("current_msg_list", {
- selected_message: function () {
+ selected_message() {
return msg;
},
- can_mark_messages_read: function () {
+ can_mark_messages_read() {
return true;
},
});
@@ -90,7 +90,7 @@ function stub_selected_message(msg) {
function stub_channel_get(success_value) {
set_global("channel", {
- get: function (opts) {
+ get(opts) {
opts.success(success_value);
},
});
diff --git a/frontend_tests/node_tests/compose_fade.js b/frontend_tests/node_tests/compose_fade.js
index 12025a9e45..2997db0834 100644
--- a/frontend_tests/node_tests/compose_fade.js
+++ b/frontend_tests/node_tests/compose_fade.js
@@ -40,13 +40,13 @@ run_test("set_focused_recipient", () => {
switch (selector) {
case "#stream_message_recipient_stream":
return {
- val: function () {
+ val() {
return "social";
},
};
case "#stream_message_recipient_topic":
return {
- val: function () {
+ val() {
return "lunch";
},
};
diff --git a/frontend_tests/node_tests/compose_pm_pill.js b/frontend_tests/node_tests/compose_pm_pill.js
index f9195e11e8..a58db08172 100644
--- a/frontend_tests/node_tests/compose_pm_pill.js
+++ b/frontend_tests/node_tests/compose_pm_pill.js
@@ -1,7 +1,7 @@
set_global("$", global.make_zjquery());
const _people = {
- small_avatar_url_for_person: function () {
+ small_avatar_url_for_person() {
return "http://example.com/example.png";
},
};
diff --git a/frontend_tests/node_tests/compose_ui.js b/frontend_tests/node_tests/compose_ui.js
index b13dbd1606..0eb1b2a747 100644
--- a/frontend_tests/node_tests/compose_ui.js
+++ b/frontend_tests/node_tests/compose_ui.js
@@ -3,7 +3,7 @@ zrequire("people");
zrequire("user_status");
set_global("document", {
- execCommand: function () {
+ execCommand() {
return false;
},
});
diff --git a/frontend_tests/node_tests/composebox_typeahead.js b/frontend_tests/node_tests/composebox_typeahead.js
index 6873065366..dc9cfbc0ec 100644
--- a/frontend_tests/node_tests/composebox_typeahead.js
+++ b/frontend_tests/node_tests/composebox_typeahead.js
@@ -316,7 +316,7 @@ run_test("content_typeahead_selected", () => {
};
let autosize_called = false;
set_global("compose_ui", {
- autosize_textarea: function () {
+ autosize_textarea() {
autosize_called = true;
},
});
diff --git a/frontend_tests/node_tests/dispatch.js b/frontend_tests/node_tests/dispatch.js
index 4ab4bdd7dd..e22298a018 100644
--- a/frontend_tests/node_tests/dispatch.js
+++ b/frontend_tests/node_tests/dispatch.js
@@ -15,7 +15,7 @@ global.patch_builtin("setTimeout", (func) => func());
set_global("home_msg_list", {
rerender: noop,
select_id: noop,
- selected_id: function () {
+ selected_id() {
return 1;
},
});
@@ -62,7 +62,7 @@ set_global("compose", {
});
set_global("settings_exports", {
- populate_exports_table: function (exports) {
+ populate_exports_table(exports) {
return exports;
},
clear_success_banner: noop,
@@ -82,13 +82,13 @@ set_global("current_msg_list", {rerender: noop});
// We use blueslip to print the traceback
set_global("blueslip", {
info: noop,
- error: function (msg, more_info, stack) {
+ error(msg, more_info, stack) {
console.log("\nFailed to process an event:\n", more_info.event, "\n");
const error = new Error();
error.stack = stack;
throw error;
},
- exception_msg: function (ex) {
+ exception_msg(ex) {
return ex.message;
},
});
diff --git a/frontend_tests/node_tests/dispatch_subs.js b/frontend_tests/node_tests/dispatch_subs.js
index 4129777463..e986781ef7 100644
--- a/frontend_tests/node_tests/dispatch_subs.js
+++ b/frontend_tests/node_tests/dispatch_subs.js
@@ -27,7 +27,7 @@ test("add", (override) => {
const stream_id = sub.stream_id;
stream_data.add_sub({
- stream_id: stream_id,
+ stream_id,
name: sub.name,
});
@@ -70,7 +70,7 @@ test("remove", (override) => {
const stream_id = event_sub.stream_id;
const sub = {
- stream_id: stream_id,
+ stream_id,
name: event_sub.name,
};
diff --git a/frontend_tests/node_tests/drafts.js b/frontend_tests/node_tests/drafts.js
index 089392cccf..5f828c0a34 100644
--- a/frontend_tests/node_tests/drafts.js
+++ b/frontend_tests/node_tests/drafts.js
@@ -14,30 +14,30 @@ const noop = function () {
};
set_global("localStorage", {
- getItem: function (key) {
+ getItem(key) {
return ls_container.get(key);
},
- setItem: function (key, val) {
+ setItem(key, val) {
ls_container.set(key, val);
},
- removeItem: function (key) {
+ removeItem(key) {
ls_container.delete(key);
},
- clear: function () {
+ clear() {
ls_container.clear();
},
});
set_global("compose", {});
set_global("compose_state", {});
set_global("stream_data", {
- get_color: function () {
+ get_color() {
return "#FFFFFF";
},
});
set_global("people", {
// Mocking get_by_email function, here we are
// just returning string before `@` in email
- get_by_email: function (email) {
+ get_by_email(email) {
return {
full_name: email.split("@")[0],
};
diff --git a/frontend_tests/node_tests/filter.js b/frontend_tests/node_tests/filter.js
index 687c7fe35c..903b0cac81 100644
--- a/frontend_tests/node_tests/filter.js
+++ b/frontend_tests/node_tests/filter.js
@@ -42,7 +42,7 @@ function assert_same_operators(result, terms) {
negated = false;
}
return {
- negated: negated,
+ negated,
operator: term.operator,
operand: term.operand,
};
@@ -524,8 +524,8 @@ function get_predicate(operators) {
function make_sub(name, stream_id) {
const sub = {
- name: name,
- stream_id: stream_id,
+ name,
+ stream_id,
};
global.stream_data.add_sub(sub);
}
@@ -546,8 +546,8 @@ run_test("predicate_basics", () => {
["topic", "Bar"],
]);
- assert(predicate({type: "stream", stream_id: stream_id, topic: "bar"}));
- assert(!predicate({type: "stream", stream_id: stream_id, topic: "whatever"}));
+ assert(predicate({type: "stream", stream_id, topic: "bar"}));
+ assert(!predicate({type: "stream", stream_id, topic: "whatever"}));
assert(!predicate({type: "stream", stream_id: 9999999}));
assert(!predicate({type: "private"}));
@@ -1175,9 +1175,9 @@ run_test("term_type", () => {
function term(operator, operand, negated) {
return {
- operator: operator,
- operand: operand,
- negated: negated,
+ operator,
+ operand,
+ negated,
};
}
@@ -1277,8 +1277,8 @@ run_test("update_email", () => {
function make_private_sub(name, stream_id) {
const sub = {
- name: name,
- stream_id: stream_id,
+ name,
+ stream_id,
invite_only: true,
};
global.stream_data.add_sub(sub);
@@ -1286,8 +1286,8 @@ function make_private_sub(name, stream_id) {
function make_web_public_sub(name, stream_id) {
const sub = {
- name: name,
- stream_id: stream_id,
+ name,
+ stream_id,
is_web_public: true,
};
global.stream_data.add_sub(sub);
diff --git a/frontend_tests/node_tests/general.js b/frontend_tests/node_tests/general.js
index 4c81157861..4461381922 100644
--- a/frontend_tests/node_tests/general.js
+++ b/frontend_tests/node_tests/general.js
@@ -381,7 +381,7 @@ function test_helper() {
events.push(full_name);
};
},
- events: events,
+ events,
};
}
diff --git a/frontend_tests/node_tests/hotkey.js b/frontend_tests/node_tests/hotkey.js
index deeaa78c48..f6d465ffac 100644
--- a/frontend_tests/node_tests/hotkey.js
+++ b/frontend_tests/node_tests/hotkey.js
@@ -32,17 +32,17 @@ zrequire("common");
set_global("list_util", {});
set_global("current_msg_list", {
- selected_id: function () {
+ selected_id() {
return 42;
},
- selected_message: function () {
+ selected_message() {
return {
sent_by_me: true,
flags: ["read", "starred"],
};
},
- selected_row: function () {},
- get_row: function () {
+ selected_row() {},
+ get_row() {
return 101;
},
});
@@ -66,17 +66,17 @@ function stubbing(func_name_to_stub, test_function) {
run_test("mappings", () => {
function map_press(which, shiftKey) {
return hotkey.get_keypress_hotkey({
- which: which,
- shiftKey: shiftKey,
+ which,
+ shiftKey,
});
}
function map_down(which, shiftKey, ctrlKey, metaKey) {
return hotkey.get_keydown_hotkey({
- which: which,
- shiftKey: shiftKey,
- ctrlKey: ctrlKey,
- metaKey: metaKey,
+ which,
+ shiftKey,
+ ctrlKey,
+ metaKey,
});
}
@@ -211,9 +211,9 @@ run_test("basic_chars", () => {
for (const is_active of [return_true, return_false]) {
for (const info_overlay_open of [return_true, return_false]) {
set_global("overlays", {
- is_active: is_active,
- settings_open: settings_open,
- info_overlay_open: info_overlay_open,
+ is_active,
+ settings_open,
+ info_overlay_open,
});
test_normal_typing();
}
@@ -345,8 +345,8 @@ run_test("motion_keys", () => {
function process(name, shiftKey, ctrlKey) {
const e = {
which: codes[name],
- shiftKey: shiftKey,
- ctrlKey: ctrlKey,
+ shiftKey,
+ ctrlKey,
};
try {
diff --git a/frontend_tests/node_tests/input_pill.js b/frontend_tests/node_tests/input_pill.js
index 0cf495bbdb..d677dd4dcb 100644
--- a/frontend_tests/node_tests/input_pill.js
+++ b/frontend_tests/node_tests/input_pill.js
@@ -34,7 +34,7 @@ function pill_html(value, data_id, img_src) {
const opts = {
id: data_id,
display_value: value,
- has_image: has_image,
+ has_image,
};
if (has_image) {
@@ -117,18 +117,18 @@ function set_up() {
container.set_find_results(".input", pill_input);
const config = {
- container: container,
- create_item_from_text: create_item_from_text,
+ container,
+ create_item_from_text,
get_text_from_item: (item) => item.display_value,
};
id_seq = 0;
return {
- config: config,
- pill_input: pill_input,
- items: items,
- container: container,
+ config,
+ pill_input,
+ items,
+ container,
};
}
diff --git a/frontend_tests/node_tests/list_cursor.js b/frontend_tests/node_tests/list_cursor.js
index 79f8e7c964..ef2024453d 100644
--- a/frontend_tests/node_tests/list_cursor.js
+++ b/frontend_tests/node_tests/list_cursor.js
@@ -15,7 +15,7 @@ function basic_conf() {
};
const conf = {
- list: list,
+ list,
highlight_class: "highlight",
};
diff --git a/frontend_tests/node_tests/list_render.js b/frontend_tests/node_tests/list_render.js
index bb612ea741..863bdef8b7 100644
--- a/frontend_tests/node_tests/list_render.js
+++ b/frontend_tests/node_tests/list_render.js
@@ -269,7 +269,7 @@ function sort_button(opts) {
const classList = new Set();
const button = {
- data: data,
+ data,
closest: lookup(".progressive-table-wrapper", {
data: lookup("list-render", opts.list_name),
}),
@@ -637,7 +637,7 @@ run_test("opts.get_item", () => {
const predicate_opts = {
get_item: (n) => items[n],
filter: {
- predicate: predicate,
+ predicate,
},
};
@@ -691,7 +691,7 @@ run_test("render item", () => {
const widget = list_render.create(container, list, {
name: "replace-list",
modifier: (item) => `
${item.text}
\n`,
- get_item: get_item,
+ get_item,
html_selector: (item) => `tr[data-item='${item}']`,
simplebar_container: scroll_container,
});
@@ -726,7 +726,7 @@ run_test("render item", () => {
list_render.create(container, list, {
name: "replace-list",
modifier: (item) => `${item.text}
\n`,
- get_item: get_item,
+ get_item,
html_selector: "hello world",
simplebar_container: scroll_container,
});
@@ -751,7 +751,7 @@ run_test("render item", () => {
const widget_3 = list_render.create(container, list, {
name: "replace-list",
modifier: (item) => (rendering_item ? undefined : `${item}\n`),
- get_item: get_item,
+ get_item,
html_selector: (item) => `tr[data-item='${item}']`,
simplebar_container: scroll_container,
});
diff --git a/frontend_tests/node_tests/message_fetch.js b/frontend_tests/node_tests/message_fetch.js
index 91a51a5607..c334dc84cf 100644
--- a/frontend_tests/node_tests/message_fetch.js
+++ b/frontend_tests/node_tests/message_fetch.js
@@ -63,8 +63,8 @@ function make_home_msg_list() {
const filter = new Filter();
const list = new message_list.MessageList({
- table_name: table_name,
- filter: filter,
+ table_name,
+ filter,
});
return list;
}
@@ -205,8 +205,8 @@ function initial_fetch_step() {
self.finish = function () {
test_fetch_success({
- fetch: fetch,
- response: response,
+ fetch,
+ response,
});
};
@@ -233,8 +233,8 @@ function forward_fill_step() {
};
test_fetch_success({
- fetch: fetch,
- response: response,
+ fetch,
+ response,
});
assert.equal(idle_config.idle, 10000);
@@ -255,8 +255,8 @@ function test_backfill_idle(idle_config) {
idle_config.onIdle();
test_fetch_success({
- fetch: fetch,
- response: response,
+ fetch,
+ response,
});
}
@@ -291,7 +291,7 @@ function simulate_narrow() {
const msg_list = new message_list.MessageList({
table_name: "zfilt",
- filter: filter,
+ filter,
});
set_global("current_msg_list", msg_list);
@@ -302,7 +302,7 @@ run_test("loading_newer", () => {
function test_dup_new_fetch(msg_list) {
assert.equal(msg_list.data.fetch_status.can_load_newer_messages(), false);
message_fetch.maybe_load_newer_messages({
- msg_list: msg_list,
+ msg_list,
});
}
@@ -321,7 +321,7 @@ run_test("loading_newer", () => {
assert.throws(
() => {
message_fetch.maybe_load_newer_messages({
- msg_list: msg_list,
+ msg_list,
show_loading: noop,
hide_loading: noop,
});
@@ -333,7 +333,7 @@ run_test("loading_newer", () => {
);
} else {
message_fetch.maybe_load_newer_messages({
- msg_list: msg_list,
+ msg_list,
show_loading: noop,
hide_loading: noop,
});
@@ -341,7 +341,7 @@ run_test("loading_newer", () => {
test_dup_new_fetch(msg_list);
test_fetch_success({
- fetch: fetch,
+ fetch,
response: data.resp,
});
}
@@ -365,8 +365,8 @@ run_test("loading_newer", () => {
};
test_happy_path({
- msg_list: msg_list,
- data: data,
+ msg_list,
+ data,
empty_msg_list: true,
});
@@ -376,8 +376,8 @@ run_test("loading_newer", () => {
msg_list.append(message_range(444, 445), false);
test_happy_path({
- msg_list: msg_list,
- data: data,
+ msg_list,
+ data,
empty_msg_list: false,
});
@@ -392,8 +392,8 @@ run_test("loading_newer", () => {
msg_list.data.fetch_status.update_expected_max_message_id([{id: 600}]);
test_happy_path({
- msg_list: msg_list,
- data: data,
+ msg_list,
+ data,
});
// To handle this special case we should allow another fetch to occur,
@@ -434,7 +434,7 @@ run_test("loading_newer", () => {
];
test_happy_path({
- msg_list: msg_list,
+ msg_list,
data: data[0],
empty_msg_list: true,
});
@@ -443,7 +443,7 @@ run_test("loading_newer", () => {
message_list.all.append(message_range(444, 445), false);
test_happy_path({
- msg_list: msg_list,
+ msg_list,
data: data[0],
empty_msg_list: false,
});
@@ -451,7 +451,7 @@ run_test("loading_newer", () => {
assert.equal(msg_list.data.fetch_status.can_load_newer_messages(), true);
test_happy_path({
- msg_list: msg_list,
+ msg_list,
data: data[1],
});
diff --git a/frontend_tests/node_tests/message_list.js b/frontend_tests/node_tests/message_list.js
index ab60d82efa..b08b5c6eec 100644
--- a/frontend_tests/node_tests/message_list.js
+++ b/frontend_tests/node_tests/message_list.js
@@ -29,7 +29,7 @@ run_test("basics", () => {
const filter = accept_all_filter();
const list = new MessageList({
- filter: filter,
+ filter,
});
const messages = [
@@ -438,7 +438,7 @@ run_test("unmuted_messages", () => {
run_test("add_remove_rerender", () => {
const filter = accept_all_filter();
- const list = new MessageList({filter: filter});
+ const list = new MessageList({filter});
const messages = [{id: 1}, {id: 2}, {id: 3}];
diff --git a/frontend_tests/node_tests/message_list_view.js b/frontend_tests/node_tests/message_list_view.js
index b943080752..858f6fc09d 100644
--- a/frontend_tests/node_tests/message_list_view.js
+++ b/frontend_tests/node_tests/message_list_view.js
@@ -15,20 +15,20 @@ set_global("page_params", {
});
set_global("home_msg_list", null);
set_global("people", {
- small_avatar_url: function () {
+ small_avatar_url() {
return "";
},
});
-set_global("unread", {message_unread: function () {}});
+set_global("unread", {message_unread() {}});
// timerender calls setInterval when imported
set_global("timerender", {
- render_date: function (time1, time2) {
+ render_date(time1, time2) {
if (time2 === undefined) {
return [{outerHTML: String(time1.getTime())}];
}
return [{outerHTML: String(time1.getTime()) + " - " + String(time2.getTime())}];
},
- stringify_time: function (time) {
+ stringify_time(time) {
if (page_params.twenty_four_hour_time) {
return time.toString("HH:mm");
}
@@ -37,9 +37,9 @@ set_global("timerender", {
});
set_global("rows", {
- get_table: function () {
+ get_table() {
return {
- children: function () {
+ children() {
return {
detach: noop,
};
@@ -166,8 +166,8 @@ run_test("merge_message_groups", () => {
const list = new MessageListView(undefined, undefined, true);
list._message_groups = message_groups;
list.list = {
- unsubscribed_bookend_content: function () {},
- subscribed_bookend_content: function () {},
+ unsubscribed_bookend_content() {},
+ subscribed_bookend_content() {},
};
return list;
}
@@ -440,8 +440,8 @@ run_test("render_windows", () => {
const filter = new Filter();
const list = new message_list.MessageList({
- table_name: table_name,
- filter: filter,
+ table_name,
+ filter,
});
const view = list.view;
diff --git a/frontend_tests/node_tests/message_store.js b/frontend_tests/node_tests/message_store.js
index 3275b02379..e7276835ac 100644
--- a/frontend_tests/node_tests/message_store.js
+++ b/frontend_tests/node_tests/message_store.js
@@ -145,7 +145,7 @@ run_test("message_booleans_parity", () => {
// This test asserts that both have identical behavior for the
// flags common between them.
const assert_bool_match = (flags, expected_message) => {
- const set_message = {topic: "set_message_booleans", flags: flags};
+ const set_message = {topic: "set_message_booleans", flags};
const update_message = {topic: "update_booleans"};
message_store.set_message_booleans(set_message);
message_store.update_booleans(update_message, flags);
@@ -206,7 +206,7 @@ run_test("errors", () => {
// This should early return and not run pm_conversation.set_partner
let num_partner = 0;
set_global("pm_conversation", {
- set_partner: function () {
+ set_partner() {
num_partner += 1;
},
});
@@ -270,7 +270,7 @@ run_test("message_id_change", () => {
set_global("pointer", {
furthest_read: 401,
- set_furthest_read: function (value) {
+ set_furthest_read(value) {
this.furthest_read = value;
},
});
diff --git a/frontend_tests/node_tests/narrow_activate.js b/frontend_tests/node_tests/narrow_activate.js
index 738538c1c8..a8578550d8 100644
--- a/frontend_tests/node_tests/narrow_activate.js
+++ b/frontend_tests/node_tests/narrow_activate.js
@@ -21,7 +21,7 @@ set_global("hashchange", {});
set_global("home_msg_list", {});
set_global("message_fetch", {});
set_global("message_list", {
- set_narrowed: function (value) {
+ set_narrowed(value) {
this.narrowed = value;
},
});
@@ -38,10 +38,10 @@ set_global("ui_util", {});
set_global("unread_ops", {});
set_global("search_pill_widget", {
widget: {
- clear: function () {
+ clear() {
return true;
},
- appendValue: function () {
+ appendValue() {
return true;
},
},
@@ -112,7 +112,7 @@ function stub_message_list() {
const list = this;
this.data = opts.data;
this.view = {
- set_message_offset: function (offset) {
+ set_message_offset(offset) {
list.view.offset = offset;
},
};
@@ -121,15 +121,15 @@ function stub_message_list() {
};
message_list.MessageList.prototype = {
- get: function (msg_id) {
+ get(msg_id) {
return this.data.get(msg_id);
},
- empty: function () {
+ empty() {
return this.data.empty();
},
- select_id: function (msg_id) {
+ select_id(msg_id) {
this.selected_id = msg_id;
},
};
diff --git a/frontend_tests/node_tests/narrow_local.js b/frontend_tests/node_tests/narrow_local.js
index 2ae2643a26..8bdefccc81 100644
--- a/frontend_tests/node_tests/narrow_local.js
+++ b/frontend_tests/node_tests/narrow_local.js
@@ -28,7 +28,7 @@ function test_with(fixture) {
const muting_enabled = narrow_state.muting_enabled();
const msg_data = new MessageListData({
filter: narrow_state.filter(),
- muting_enabled: muting_enabled,
+ muting_enabled,
});
const id_info = {
target_id: fixture.target_id,
@@ -60,8 +60,8 @@ function test_with(fixture) {
narrow_state.get_first_unread_info = () => fixture.unread_info;
narrow.maybe_add_local_messages({
- id_info: id_info,
- msg_data: msg_data,
+ id_info,
+ msg_data,
});
assert.deepEqual(id_info, fixture.expected_id_info);
diff --git a/frontend_tests/node_tests/notifications.js b/frontend_tests/node_tests/notifications.js
index b8907d1822..a8da203c1f 100644
--- a/frontend_tests/node_tests/notifications.js
+++ b/frontend_tests/node_tests/notifications.js
@@ -6,7 +6,7 @@ set_global(
}),
);
set_global("document", {
- hasFocus: function () {
+ hasFocus() {
return true;
},
});
diff --git a/frontend_tests/node_tests/people.js b/frontend_tests/node_tests/people.js
index 0ab8ed1456..2a1bcdddbb 100644
--- a/frontend_tests/node_tests/people.js
+++ b/frontend_tests/node_tests/people.js
@@ -486,10 +486,10 @@ initialize();
run_test("recipient_counts", () => {
const user_id = 99;
- assert.equal(people.get_recipient_count({user_id: user_id}), 0);
+ assert.equal(people.get_recipient_count({user_id}), 0);
people.incr_recipient_count(user_id);
people.incr_recipient_count(user_id);
- assert.equal(people.get_recipient_count({user_id: user_id}), 2);
+ assert.equal(people.get_recipient_count({user_id}), 2);
assert.equal(people.get_recipient_count({pm_recipient_count: 5}), 5);
});
@@ -852,7 +852,7 @@ run_test("updates", () => {
let person = {
email: old_email,
- user_id: user_id,
+ user_id,
full_name: "Foo Barson",
};
people.add_active_user(person);
diff --git a/frontend_tests/node_tests/pm_list.js b/frontend_tests/node_tests/pm_list.js
index fa55d711e1..79ce5d1cb3 100644
--- a/frontend_tests/node_tests/pm_list.js
+++ b/frontend_tests/node_tests/pm_list.js
@@ -5,7 +5,7 @@ set_global("ui", {
get_content_element: (element) => element,
});
set_global("stream_popover", {
- hide_topic_popover: function () {},
+ hide_topic_popover() {},
});
set_global("unread", {});
set_global("unread_ui", {});
diff --git a/frontend_tests/node_tests/poll_widget.js b/frontend_tests/node_tests/poll_widget.js
index f0ccf334a0..a7c27ac82b 100644
--- a/frontend_tests/node_tests/poll_widget.js
+++ b/frontend_tests/node_tests/poll_widget.js
@@ -152,7 +152,7 @@ run_test("activate another person poll", () => {
const opts = {
elem: widget_elem,
- callback: callback,
+ callback,
message: {
sender_id: 100,
},
@@ -298,7 +298,7 @@ run_test("activate own poll", () => {
};
const opts = {
elem: widget_elem,
- callback: callback,
+ callback,
message: {
sender_id: 100,
},
diff --git a/frontend_tests/node_tests/reactions.js b/frontend_tests/node_tests/reactions.js
index 0261f7f2a4..741e0c3bb5 100644
--- a/frontend_tests/node_tests/reactions.js
+++ b/frontend_tests/node_tests/reactions.js
@@ -33,7 +33,7 @@ emoji.initialize();
set_global("channel", {});
set_global("emoji_picker", {
- hide_emoji_popover: function () {},
+ hide_emoji_popover() {},
});
const alice = {
@@ -75,20 +75,20 @@ const message = {
};
set_global("message_store", {
- get: function (message_id) {
+ get(message_id) {
assert.equal(message_id, 1001);
return message;
},
});
set_global("current_msg_list", {
- selected_message: function () {
+ selected_message() {
return {sent_by_me: true};
},
- selected_row: function () {
+ selected_row() {
return $(".selected-row");
},
- selected_id: function () {
+ selected_id() {
return 42;
},
});
@@ -461,8 +461,8 @@ run_test("with_view_stubs", () => {
function add_call_func(name) {
return function (opts) {
calls.push({
- name: name,
- opts: opts,
+ name,
+ opts,
});
};
}
@@ -503,7 +503,7 @@ run_test("with_view_stubs", () => {
};
test_view_calls({
- run_code: function () {
+ run_code() {
reactions.add_reaction(alice_8ball_event);
},
expected_view_calls: [
@@ -521,7 +521,7 @@ run_test("with_view_stubs", () => {
});
test_view_calls({
- run_code: function () {
+ run_code() {
reactions.add_reaction(bob_8ball_event);
},
expected_view_calls: [
@@ -540,7 +540,7 @@ run_test("with_view_stubs", () => {
});
test_view_calls({
- run_code: function () {
+ run_code() {
reactions.add_reaction(cali_airplane_event);
},
expected_view_calls: [
@@ -558,7 +558,7 @@ run_test("with_view_stubs", () => {
});
test_view_calls({
- run_code: function () {
+ run_code() {
reactions.remove_reaction(bob_8ball_event);
},
expected_view_calls: [
@@ -577,7 +577,7 @@ run_test("with_view_stubs", () => {
});
test_view_calls({
- run_code: function () {
+ run_code() {
reactions.remove_reaction(alice_8ball_event);
},
expected_view_calls: [
diff --git a/frontend_tests/node_tests/recent_topics.js b/frontend_tests/node_tests/recent_topics.js
index 062606b00e..4d97462475 100644
--- a/frontend_tests/node_tests/recent_topics.js
+++ b/frontend_tests/node_tests/recent_topics.js
@@ -17,7 +17,7 @@ set_global("overlays", {
recent_topics_open: () => true,
});
set_global("people", {
- is_my_user_id: function (id) {
+ is_my_user_id(id) {
return id === 1;
},
sender_info_with_small_avatar_urls_for_sender_ids: (ids) => ids,
@@ -112,7 +112,7 @@ const messages = [];
set_global("message_list", {
all: {
- all_messages: function () {
+ all_messages() {
return messages;
},
},
@@ -256,8 +256,8 @@ function generate_topic_data(topic_info_array) {
const topic_selector = $.create("#recent_topic:" + get_topic_key(stream_id, topic));
topic_selector.data = function () {
return {
- participated: participated,
- muted: muted,
+ participated,
+ muted,
unreadCount: unread_count,
};
};
@@ -272,15 +272,15 @@ function generate_topic_data(topic_info_array) {
senders: [1, 2],
stream: "stream" + stream_id,
stream_color: "",
- stream_id: stream_id,
+ stream_id,
stream_url: "https://www.example.com",
- topic: topic,
+ topic,
topic_key: get_topic_key(stream_id, topic),
topic_url: "https://www.example.com",
- unread_count: unread_count,
- muted: muted,
+ unread_count,
+ muted,
topic_muted: muted,
- participated: participated,
+ participated,
});
}
return data;
@@ -638,7 +638,7 @@ run_test("test_delete_messages", () => {
set_global("message_list", {
all: {
- all_messages: function () {
+ all_messages() {
// messages[0] was removed.
const reduced_msgs = [...messages];
reduced_msgs.splice(0, 1);
@@ -662,7 +662,7 @@ run_test("test_delete_messages", () => {
set_global("message_list", {
all: {
- all_messages: function () {
+ all_messages() {
// messages[0], messages[1] and message[2] were removed.
const reduced_msgs = [...messages];
reduced_msgs.splice(0, 3);
@@ -683,7 +683,7 @@ run_test("test_delete_messages", () => {
run_test("test_topic_edit", () => {
set_global("message_list", {
all: {
- all_messages: function () {
+ all_messages() {
return messages;
},
},
diff --git a/frontend_tests/node_tests/search_pill.js b/frontend_tests/node_tests/search_pill.js
index fb406b3318..200c60d524 100644
--- a/frontend_tests/node_tests/search_pill.js
+++ b/frontend_tests/node_tests/search_pill.js
@@ -54,7 +54,7 @@ run_test("get_items", () => {
const items = [is_starred_item, is_private_item];
const pill_widget = {
- items: function () {
+ items() {
return items;
},
};
diff --git a/frontend_tests/node_tests/search_suggestion.js b/frontend_tests/node_tests/search_suggestion.js
index 331d90f2a4..7ca20e0762 100644
--- a/frontend_tests/node_tests/search_suggestion.js
+++ b/frontend_tests/node_tests/search_suggestion.js
@@ -326,9 +326,9 @@ run_test("group_suggestions", () => {
return {
type: "private",
display_recipient: user_ids.map((id) => ({
- id: id,
+ id,
})),
- timestamp: timestamp,
+ timestamp,
};
}
@@ -713,7 +713,7 @@ run_test("topic_suggestions", () => {
for (const topic_name of ["team", "ignore", "test"]) {
stream_topic_history.add_message({
stream_id: office_id,
- topic_name: topic_name,
+ topic_name,
});
}
diff --git a/frontend_tests/node_tests/search_suggestion_legacy.js b/frontend_tests/node_tests/search_suggestion_legacy.js
index e909ca9845..92d693d40e 100644
--- a/frontend_tests/node_tests/search_suggestion_legacy.js
+++ b/frontend_tests/node_tests/search_suggestion_legacy.js
@@ -330,9 +330,9 @@ run_test("group_suggestions", () => {
return {
type: "private",
display_recipient: user_ids.map((id) => ({
- id: id,
+ id,
})),
- timestamp: timestamp,
+ timestamp,
};
}
@@ -680,7 +680,7 @@ run_test("topic_suggestions", () => {
for (const topic_name of ["team", "ignore", "test"]) {
stream_topic_history.add_message({
stream_id: office_id,
- topic_name: topic_name,
+ topic_name,
});
}
diff --git a/frontend_tests/node_tests/server_events.js b/frontend_tests/node_tests/server_events.js
index 0b652385aa..fc2bb7ec7a 100644
--- a/frontend_tests/node_tests/server_events.js
+++ b/frontend_tests/node_tests/server_events.js
@@ -12,13 +12,13 @@ zrequire("sent_messages");
set_global("channel", {});
set_global("home_msg_list", {
select_id: noop,
- selected_id: function () {
+ selected_id() {
return 1;
},
});
set_global("page_params", {test_suite: false});
set_global("reload_state", {
- is_in_progress: function () {
+ is_in_progress() {
return false;
},
});
@@ -27,16 +27,16 @@ set_global("reload_state", {
set_global("pointer", {});
set_global("echo", {
- process_from_server: function (messages) {
+ process_from_server(messages) {
return messages;
},
update_realm_filter_rules: noop,
});
set_global("ui_report", {
- hide_error: function () {
+ hide_error() {
return false;
},
- show_error: function () {
+ show_error() {
return false;
},
});
@@ -54,7 +54,7 @@ run_test("message_event", () => {
let inserted;
set_global("message_events", {
- insert_new_messages: function (messages) {
+ insert_new_messages(messages) {
assert.equal(messages[0].content, event.message.content);
inserted = true;
},
@@ -69,15 +69,15 @@ run_test("message_event", () => {
const setup = function () {
server_events.home_view_loaded();
set_global("message_events", {
- insert_new_messages: function () {
+ insert_new_messages() {
throw Error("insert error");
},
- update_messages: function () {
+ update_messages() {
throw Error("update error");
},
});
set_global("stream_events", {
- update_property: function () {
+ update_property() {
throw Error("subs update error");
},
});
diff --git a/frontend_tests/node_tests/settings_org.js b/frontend_tests/node_tests/settings_org.js
index 963dd82066..b34aff6c23 100644
--- a/frontend_tests/node_tests/settings_org.js
+++ b/frontend_tests/node_tests/settings_org.js
@@ -5,7 +5,7 @@ const noop = () => {};
let form_data;
const _jQuery = {
- each: function (lst, f) {
+ each(lst, f) {
for (const [k, v] of lst.entries()) {
f(k, v);
}
@@ -43,11 +43,11 @@ global.stub_templates((name, data) => {
const _overlays = {};
const _ui_report = {
- success: function (msg, elem) {
+ success(msg, elem) {
elem.val(msg);
},
- error: function (msg, xhr, elem) {
+ error(msg, xhr, elem) {
elem.val(msg);
},
};
@@ -165,11 +165,11 @@ function createSaveButtons(subsection) {
props.hidden = true;
};
return {
- props: props,
+ props,
save_button: stub_save_button,
discard_button: stub_discard_button,
save_button_header: stub_save_button_header,
- save_button_controls: save_button_controls,
+ save_button_controls,
save_button_text: stub_save_button_text,
};
}
@@ -348,7 +348,7 @@ function test_change_save_button_state() {
function test_upload_realm_icon(upload_realm_logo_or_icon) {
form_data = {
- append: function (field, val) {
+ append(field, val) {
form_data[field] = val;
},
};
diff --git a/frontend_tests/node_tests/settings_profile_fields.js b/frontend_tests/node_tests/settings_profile_fields.js
index 56db51ff4d..61d9db52b7 100644
--- a/frontend_tests/node_tests/settings_profile_fields.js
+++ b/frontend_tests/node_tests/settings_profile_fields.js
@@ -165,8 +165,8 @@ run_test("populate_profile_fields", () => {
];
test_populate({
- fields_data: fields_data,
- expected_template_data: expected_template_data,
+ fields_data,
+ expected_template_data,
is_admin: true,
});
});
diff --git a/frontend_tests/node_tests/settings_user_groups.js b/frontend_tests/node_tests/settings_user_groups.js
index 508f484e33..55ededb465 100644
--- a/frontend_tests/node_tests/settings_user_groups.js
+++ b/frontend_tests/node_tests/settings_user_groups.js
@@ -23,7 +23,7 @@ set_global("user_groups", {
set_global("ui_report", {});
set_global("people", {
my_current_user_id: noop,
- small_avatar_url_for_person: function () {
+ small_avatar_url_for_person() {
return "http://example.com/example.png";
},
});
@@ -620,7 +620,7 @@ run_test("on_events", () => {
let default_action_for_enter_stopped = false;
const event = {
which: 13,
- preventDefault: function () {
+ preventDefault() {
default_action_for_enter_stopped = true;
},
};
diff --git a/frontend_tests/node_tests/stream_data.js b/frontend_tests/node_tests/stream_data.js
index 532a5d2351..214952fb8a 100644
--- a/frontend_tests/node_tests/stream_data.js
+++ b/frontend_tests/node_tests/stream_data.js
@@ -950,10 +950,10 @@ run_test("filter inactives", () => {
const stream_id = 100 + i;
const sub = {
- name: name,
+ name,
subscribed: true,
newly_subscribed: false,
- stream_id: stream_id,
+ stream_id,
};
stream_data.add_sub(sub);
});
diff --git a/frontend_tests/node_tests/stream_events.js b/frontend_tests/node_tests/stream_events.js
index 674912ab90..c3d9e1f56b 100644
--- a/frontend_tests/node_tests/stream_events.js
+++ b/frontend_tests/node_tests/stream_events.js
@@ -210,7 +210,7 @@ run_test("marked_subscribed", () => {
set_global("message_list", {
all: {
- all_messages: function () {
+ all_messages() {
return ["msg"];
},
},
diff --git a/frontend_tests/node_tests/stream_list.js b/frontend_tests/node_tests/stream_list.js
index 08c76fffaa..0b486be7e8 100644
--- a/frontend_tests/node_tests/stream_list.js
+++ b/frontend_tests/node_tests/stream_list.js
@@ -228,8 +228,8 @@ set_global("$", global.make_zjquery());
function add_row(sub) {
global.stream_data.add_sub(sub);
const row = {
- update_whether_active: function () {},
- get_li: function () {
+ update_whether_active() {},
+ get_li() {
const html = "<" + sub.name + " sidebar row html>";
const obj = $(html);
@@ -383,7 +383,7 @@ run_test("narrowing", () => {
initialize_stream_data();
set_global("narrow_state", {
- stream: function () {
+ stream() {
return "devel";
},
topic: noop,
@@ -445,7 +445,7 @@ run_test("focusout_user_filter", () => {
run_test("focus_user_filter", () => {
const e = {
- stopPropagation: function () {},
+ stopPropagation() {},
};
const click_handler = $(".stream-list-filter").get_on_handler("click");
click_handler(e);
@@ -631,7 +631,7 @@ run_test("update_count_in_dom", () => {
const stream_id = 11;
const stream_row = {
- get_li: function () {
+ get_li() {
return stream_li;
},
};
@@ -640,7 +640,7 @@ run_test("update_count_in_dom", () => {
stream_count.set(stream_id, 0);
const counts = {
- stream_count: stream_count,
+ stream_count,
topic_count: new Map(),
};
@@ -736,7 +736,7 @@ run_test("create_initial_sidebar_rows", () => {
stream_list.stream_sidebar = {
has_row_for: return_false,
- set_row: function (stream_id, widget) {
+ set_row(stream_id, widget) {
html_dict.set(stream_id, widget.get_li().html());
},
};
diff --git a/frontend_tests/node_tests/stream_search.js b/frontend_tests/node_tests/stream_search.js
index 0761b1eec3..a5329b8760 100644
--- a/frontend_tests/node_tests/stream_search.js
+++ b/frontend_tests/node_tests/stream_search.js
@@ -31,7 +31,7 @@ function make_cursor_helper() {
};
return {
- events: events,
+ events,
};
}
diff --git a/frontend_tests/node_tests/stream_topic_history.js b/frontend_tests/node_tests/stream_topic_history.js
index 67b3795879..a5850fd870 100644
--- a/frontend_tests/node_tests/stream_topic_history.js
+++ b/frontend_tests/node_tests/stream_topic_history.js
@@ -9,7 +9,7 @@ run_test("basics", () => {
const stream_id = 55;
stream_topic_history.add_message({
- stream_id: stream_id,
+ stream_id,
message_id: 101,
topic_name: "toPic1",
});
@@ -20,7 +20,7 @@ run_test("basics", () => {
assert.deepEqual(max_message_id, 101);
stream_topic_history.add_message({
- stream_id: stream_id,
+ stream_id,
message_id: 102,
topic_name: "Topic1",
});
@@ -30,7 +30,7 @@ run_test("basics", () => {
assert.deepEqual(max_message_id, 102);
stream_topic_history.add_message({
- stream_id: stream_id,
+ stream_id,
message_id: 103,
topic_name: "topic2",
});
@@ -41,7 +41,7 @@ run_test("basics", () => {
// Removing first topic1 message has no effect.
stream_topic_history.remove_messages({
- stream_id: stream_id,
+ stream_id,
topic_name: "toPic1",
num_messages: 1,
});
@@ -53,7 +53,7 @@ run_test("basics", () => {
// Removing second topic1 message removes the topic.
stream_topic_history.remove_messages({
- stream_id: stream_id,
+ stream_id,
topic_name: "Topic1",
num_messages: 1,
});
@@ -62,7 +62,7 @@ run_test("basics", () => {
// Test that duplicate remove does not crash us.
stream_topic_history.remove_messages({
- stream_id: stream_id,
+ stream_id,
topic_name: "Topic1",
num_messages: 1,
});
@@ -123,7 +123,7 @@ run_test("server_history", () => {
assert.equal(stream_topic_history.is_complete_for_stream_id(stream_id), false);
stream_topic_history.add_message({
- stream_id: stream_id,
+ stream_id,
message_id: 501,
topic_name: "local",
});
@@ -148,7 +148,7 @@ run_test("server_history", () => {
// If new activity comes in for historical messages,
// they can bump to the front of the list.
stream_topic_history.add_message({
- stream_id: stream_id,
+ stream_id,
message_id: 502,
topic_name: "hist1",
});
@@ -163,7 +163,7 @@ run_test("server_history", () => {
// Removing a local message removes the topic if we have
// our counts right.
stream_topic_history.remove_messages({
- stream_id: stream_id,
+ stream_id,
topic_name: "local",
num_messages: 1,
});
@@ -173,7 +173,7 @@ run_test("server_history", () => {
// We can try to remove a historical message, but it should
// have no effect.
stream_topic_history.remove_messages({
- stream_id: stream_id,
+ stream_id,
topic_name: "hist2",
num_messages: 1,
});
@@ -196,13 +196,13 @@ run_test("test_unread_logic", () => {
const stream_id = 77;
stream_topic_history.add_message({
- stream_id: stream_id,
+ stream_id,
message_id: 201,
topic_name: "toPic1",
});
stream_topic_history.add_message({
- stream_id: stream_id,
+ stream_id,
message_id: 45,
topic_name: "topic2",
});
@@ -241,7 +241,7 @@ run_test("test_stream_has_topics", () => {
assert.equal(stream_topic_history.stream_has_topics(stream_id), false);
stream_topic_history.add_message({
- stream_id: stream_id,
+ stream_id,
message_id: 888,
topic_name: "whatever",
});
@@ -273,7 +273,7 @@ run_test("server_history_end_to_end", () => {
on_success_called = true;
});
- get_success_callback({topics: topics});
+ get_success_callback({topics});
assert(on_success_called);
diff --git a/frontend_tests/node_tests/submessage.js b/frontend_tests/node_tests/submessage.js
index c13741eab8..915605b992 100644
--- a/frontend_tests/node_tests/submessage.js
+++ b/frontend_tests/node_tests/submessage.js
@@ -21,12 +21,12 @@ run_test("get_message_events", () => {
msg = {
locally_echoed: true,
- submessages: submessages,
+ submessages,
};
assert.equal(submessage.get_message_events(msg), undefined);
msg = {
- submessages: submessages,
+ submessages,
};
assert.deepEqual(submessage.get_message_events(msg), [
{sender_id: 33, data: 42},
@@ -44,7 +44,7 @@ run_test("make_server_callback", () => {
assert.deepEqual(opts, {
url: "/json/submessage",
data: {
- message_id: message_id,
+ message_id,
msg_type: "whatever",
content: '{"foo":32}',
},
diff --git a/frontend_tests/node_tests/top_left_corner.js b/frontend_tests/node_tests/top_left_corner.js
index 2a1c513b17..dfcbd815e3 100644
--- a/frontend_tests/node_tests/top_left_corner.js
+++ b/frontend_tests/node_tests/top_left_corner.js
@@ -13,10 +13,10 @@ run_test("narrowing", () => {
let pm_closed;
set_global("pm_list", {
- close: function () {
+ close() {
pm_closed = true;
},
- expand: function () {
+ expand() {
pm_expanded = true;
},
});
diff --git a/frontend_tests/node_tests/topic_generator.js b/frontend_tests/node_tests/topic_generator.js
index 48213f8a3c..4342e42107 100644
--- a/frontend_tests/node_tests/topic_generator.js
+++ b/frontend_tests/node_tests/topic_generator.js
@@ -150,7 +150,7 @@ run_test("fchain", () => {
const mults = function (n) {
let ret = 0;
return {
- next: function () {
+ next() {
ret += n;
return ret <= 100 ? ret : undefined;
},
diff --git a/frontend_tests/node_tests/topic_list_data.js b/frontend_tests/node_tests/topic_list_data.js
index 1cf8cf174e..ce65b33f04 100644
--- a/frontend_tests/node_tests/topic_list_data.js
+++ b/frontend_tests/node_tests/topic_list_data.js
@@ -43,7 +43,7 @@ run_test("get_list_info w/real stream_topic_history", () => {
const topic_name = "topic " + i;
stream_topic_history.add_message({
stream_id: general.stream_id,
- topic_name: topic_name,
+ topic_name,
message_id: 1000 + i,
});
}
diff --git a/frontend_tests/node_tests/transmit.js b/frontend_tests/node_tests/transmit.js
index 776d828f81..a7381f1799 100644
--- a/frontend_tests/node_tests/transmit.js
+++ b/frontend_tests/node_tests/transmit.js
@@ -116,7 +116,7 @@ run_test("reply_message_stream", () => {
transmit.reply_message({
message: stream_message,
- content: content,
+ content,
});
assert.deepEqual(send_message_args, {
@@ -159,7 +159,7 @@ run_test("reply_message_private", () => {
transmit.reply_message({
message: pm_message,
- content: content,
+ content,
});
assert.deepEqual(send_message_args, {
diff --git a/frontend_tests/node_tests/typing_status.js b/frontend_tests/node_tests/typing_status.js
index a6b9c13954..f3ebf0c54e 100644
--- a/frontend_tests/node_tests/typing_status.js
+++ b/frontend_tests/node_tests/typing_status.js
@@ -61,8 +61,8 @@ run_test("basics", () => {
worker = {
get_current_time: returns_time(5),
- notify_server_start: notify_server_start,
- notify_server_stop: notify_server_stop,
+ notify_server_start,
+ notify_server_stop,
};
// Start talking to alice.
diff --git a/frontend_tests/node_tests/unread.js b/frontend_tests/node_tests/unread.js
index f05b779ebe..301a3eb765 100644
--- a/frontend_tests/node_tests/unread.js
+++ b/frontend_tests/node_tests/unread.js
@@ -81,7 +81,7 @@ run_test("changing_topics", () => {
const message = {
id: 15,
type: "stream",
- stream_id: stream_id,
+ stream_id,
topic: "luNch",
unread: true,
};
@@ -89,7 +89,7 @@ run_test("changing_topics", () => {
const other_message = {
id: 16,
type: "stream",
- stream_id: stream_id,
+ stream_id,
topic: "lunCH",
unread: true,
};
@@ -163,7 +163,7 @@ run_test("changing_topics", () => {
const sticky_message = {
id: 17,
type: "stream",
- stream_id: stream_id,
+ stream_id,
topic: "sticky",
unread: true,
};
@@ -217,7 +217,7 @@ run_test("muting", () => {
const message = {
id: 15,
type: "stream",
- stream_id: stream_id,
+ stream_id,
topic: "test_muting",
unread: true,
};
@@ -262,7 +262,7 @@ run_test("num_unread_for_topic", () => {
const message = {
type: "stream",
- stream_id: stream_id,
+ stream_id,
topic: "LuncH",
unread: true,
};
@@ -288,8 +288,8 @@ run_test("num_unread_for_topic", () => {
const topic_dict = new FoldDict();
let missing_topics = unread.get_missing_topics({
- stream_id: stream_id,
- topic_dict: topic_dict,
+ stream_id,
+ topic_dict,
});
assert.deepEqual(missing_topics, [{pretty_name: "LuncH", message_id: 500}]);
@@ -297,8 +297,8 @@ run_test("num_unread_for_topic", () => {
topic_dict.set("lUNCh", "whatever");
missing_topics = unread.get_missing_topics({
- stream_id: stream_id,
- topic_dict: topic_dict,
+ stream_id,
+ topic_dict,
});
assert.deepEqual(missing_topics, []);
@@ -337,7 +337,7 @@ run_test("home_messages", () => {
const message = {
id: 15,
type: "stream",
- stream_id: stream_id,
+ stream_id,
topic: "lunch",
unread: true,
};
@@ -675,7 +675,7 @@ run_test("empty_cases", () => {
assert.deepEqual(unread.get_all_msg_ids(), []);
const missing_topics = unread.get_missing_topics({
- stream_id: stream_id,
+ stream_id,
topic_dict: "should-never-be-referenced",
});
assert.deepEqual(missing_topics, []);
diff --git a/frontend_tests/node_tests/upload.js b/frontend_tests/node_tests/upload.js
index cfb371858f..d9e79a9cb4 100644
--- a/frontend_tests/node_tests/upload.js
+++ b/frontend_tests/node_tests/upload.js
@@ -348,7 +348,7 @@ run_test("file_input", () => {
const files = ["file1", "file2"];
const event = {
target: {
- files: files,
+ files,
value: "C:\\fakepath\\portland.png",
},
};
@@ -388,7 +388,7 @@ run_test("file_drop", () => {
},
originalEvent: {
dataTransfer: {
- files: files,
+ files,
},
},
};
diff --git a/frontend_tests/node_tests/user_events.js b/frontend_tests/node_tests/user_events.js
index 1ec4d91f37..f74dc5910c 100644
--- a/frontend_tests/node_tests/user_events.js
+++ b/frontend_tests/node_tests/user_events.js
@@ -5,47 +5,47 @@ const settings_config = zrequire("settings_config");
zrequire("user_events");
set_global("activity", {
- redraw: function () {},
+ redraw() {},
});
set_global("settings_linkifiers", {
- maybe_disable_widgets: function () {},
+ maybe_disable_widgets() {},
});
set_global("settings_org", {
- maybe_disable_widgets: function () {},
+ maybe_disable_widgets() {},
});
set_global("settings_profile_fields", {
- maybe_disable_widgets: function () {},
+ maybe_disable_widgets() {},
});
set_global("settings_streams", {
- maybe_disable_widgets: function () {},
+ maybe_disable_widgets() {},
});
set_global("settings_users", {
- update_user_data: function () {},
+ update_user_data() {},
});
set_global("gear_menu", {
- update_org_settings_menu_item: function () {},
+ update_org_settings_menu_item() {},
});
set_global("page_params", {
is_admin: true,
});
set_global("pm_list", {
- update_private_messages: function () {},
+ update_private_messages() {},
});
set_global("narrow_state", {
- update_email: function () {},
+ update_email() {},
});
set_global("compose", {
- update_email: function () {},
+ update_email() {},
});
set_global("settings_account", {
- update_email: function () {},
- update_full_name: function () {},
+ update_email() {},
+ update_full_name() {},
});
set_global("message_live_update", {});
diff --git a/frontend_tests/node_tests/user_pill.js b/frontend_tests/node_tests/user_pill.js
index 779fc71185..da9492aefe 100644
--- a/frontend_tests/node_tests/user_pill.js
+++ b/frontend_tests/node_tests/user_pill.js
@@ -81,7 +81,7 @@ run_test("append", () => {
user_pill.append_person({
person: isaac,
- pill_widget: pill_widget,
+ pill_widget,
});
assert(appended);
@@ -92,7 +92,7 @@ run_test("get_items", () => {
const items = [isaac_item, bogus_item];
const pill_widget = {
- items: function () {
+ items() {
return items;
},
};
@@ -104,7 +104,7 @@ run_test("typeahead", () => {
const items = [isaac_item, bogus_item];
const pill_widget = {
- items: function () {
+ items() {
return items;
},
};
diff --git a/frontend_tests/node_tests/util.js b/frontend_tests/node_tests/util.js
index 3df03dc079..1c85ea7bea 100644
--- a/frontend_tests/node_tests/util.js
+++ b/frontend_tests/node_tests/util.js
@@ -9,7 +9,7 @@ run_test("CachedValue", () => {
let x = 5;
const cv = new util.CachedValue({
- compute_value: function () {
+ compute_value() {
return x * 2;
},
});
diff --git a/frontend_tests/node_tests/vdom.js b/frontend_tests/node_tests/vdom.js
index 0e37385474..6ccb22e7c8 100644
--- a/frontend_tests/node_tests/vdom.js
+++ b/frontend_tests/node_tests/vdom.js
@@ -103,9 +103,9 @@ function make_child(i, name) {
return {
key: i,
- render: render,
- name: name,
- eq: eq,
+ render,
+ name,
+ eq,
};
}
diff --git a/frontend_tests/node_tests/widgetize.js b/frontend_tests/node_tests/widgetize.js
index b020c191b8..275689ec57 100644
--- a/frontend_tests/node_tests/widgetize.js
+++ b/frontend_tests/node_tests/widgetize.js
@@ -58,7 +58,7 @@ run_test("activate", () => {
assert.equal(data.msg_type, "widget");
assert.equal(data.data, "test_data");
},
- row: row,
+ row,
widget_type: "poll",
};
diff --git a/frontend_tests/node_tests/zjquery.js b/frontend_tests/node_tests/zjquery.js
index 9a0243ef7a..4fe716e89b 100644
--- a/frontend_tests/node_tests/zjquery.js
+++ b/frontend_tests/node_tests/zjquery.js
@@ -168,7 +168,7 @@ run_test("events", () => {
// Set up a stub event so that stopPropagation doesn't explode on us.
const stub_event = {
- stopPropagation: function () {},
+ stopPropagation() {},
};
// Now call the handler.
diff --git a/frontend_tests/zjsunit/namespace.js b/frontend_tests/zjsunit/namespace.js
index 03908bd0b5..c3952b8295 100644
--- a/frontend_tests/zjsunit/namespace.js
+++ b/frontend_tests/zjsunit/namespace.js
@@ -58,10 +58,10 @@ exports.restore = function () {
exports.stub_out_jquery = function () {
set_global("$", () => ({
- on: function () {},
- trigger: function () {},
- hide: function () {},
- removeClass: function () {},
+ on() {},
+ trigger() {},
+ hide() {},
+ removeClass() {},
}));
$.fn = {};
$.now = function () {};
diff --git a/frontend_tests/zjsunit/zjquery.js b/frontend_tests/zjsunit/zjquery.js
index c41a826832..fc96b00f30 100644
--- a/frontend_tests/zjsunit/zjquery.js
+++ b/frontend_tests/zjsunit/zjquery.js
@@ -26,7 +26,7 @@ exports.make_event_store = (selector) => {
let focused = false;
const self = {
- get_on_handler: function (name, child_selector) {
+ get_on_handler(name, child_selector) {
let handler;
if (child_selector === undefined) {
@@ -49,7 +49,7 @@ exports.make_event_store = (selector) => {
return handler;
},
- off: function (event_name, ...args) {
+ off(event_name, ...args) {
if (args.length === 0) {
on_functions.delete(event_name);
return;
@@ -62,7 +62,7 @@ exports.make_event_store = (selector) => {
throw Error("zjquery does not support this call sequence");
},
- on: function (event_name, ...args) {
+ on(event_name, ...args) {
// parameters will either be
// (event_name, handler) or
// (event_name, sel, handler)
@@ -106,7 +106,7 @@ exports.make_event_store = (selector) => {
});
},
- trigger: function ($element, ev, data) {
+ trigger($element, ev, data) {
if (typeof ev === "string") {
ev = new Event(ev, data);
}
@@ -151,22 +151,22 @@ exports.make_new_elem = function (selector, opts) {
const event_store = exports.make_event_store(selector);
const self = {
- addClass: function (class_name) {
+ addClass(class_name) {
classes.set(class_name, true);
return self;
},
- append: function (arg) {
+ append(arg) {
html = html + arg;
return self;
},
- attr: function (name, val) {
+ attr(name, val) {
if (val === undefined) {
return attrs.get(name);
}
attrs.set(name, val);
return self;
},
- data: function (name, val) {
+ data(name, val) {
if (val === undefined) {
const data_val = attrs.get("data-" + name);
if (data_val === undefined) {
@@ -177,31 +177,31 @@ exports.make_new_elem = function (selector, opts) {
attrs.set("data-" + name, val);
return self;
},
- delay: function () {
+ delay() {
return self;
},
- debug: function () {
+ debug() {
return {
- value: value,
- shown: shown,
- selector: selector,
+ value,
+ shown,
+ selector,
};
},
- empty: function (arg) {
+ empty(arg) {
if (arg === undefined) {
find_results.clear();
}
return self;
},
- eq: function () {
+ eq() {
return self;
},
- expectOne: function () {
+ expectOne() {
// silently do nothing
return self;
},
fadeTo: noop,
- find: function (child_selector) {
+ find(child_selector) {
const child = find_results.get(child_selector);
if (child) {
return child;
@@ -217,30 +217,30 @@ exports.make_new_elem = function (selector, opts) {
}
throw Error("Cannot find " + child_selector + " in " + selector);
},
- get: function (idx) {
+ get(idx) {
// We have some legacy code that does $('foo').get(0).
assert.equal(idx, 0);
return selector;
},
- get_on_handler: function (name, child_selector) {
+ get_on_handler(name, child_selector) {
return event_store.get_on_handler(name, child_selector);
},
- hasClass: function (class_name) {
+ hasClass(class_name) {
return classes.has(class_name);
},
height: noop,
- hide: function () {
+ hide() {
shown = false;
return self;
},
- html: function (arg) {
+ html(arg) {
if (arg !== undefined) {
html = arg;
return self;
}
return html;
},
- is: function (arg) {
+ is(arg) {
if (arg === ":visible") {
return shown;
}
@@ -249,27 +249,27 @@ exports.make_new_elem = function (selector, opts) {
}
return self;
},
- is_focused: function () {
+ is_focused() {
// is_focused is not a jQuery thing; this is
// for our testing
return event_store.is_focused();
},
- off: function (...args) {
+ off(...args) {
event_store.off(...args);
return self;
},
- on: function (...args) {
+ on(...args) {
event_store.on(...args);
return self;
},
- one: function (...args) {
+ one(...args) {
event_store.one(...args);
return self;
},
- parent: function () {
+ parent() {
return my_parent;
},
- parents: function (parents_selector) {
+ parents(parents_selector) {
const result = parents_result.get(parents_selector);
assert(
result,
@@ -277,58 +277,58 @@ exports.make_new_elem = function (selector, opts) {
);
return result;
},
- prepend: function (arg) {
+ prepend(arg) {
html = arg + html;
return self;
},
- prop: function (name, val) {
+ prop(name, val) {
if (val === undefined) {
return properties.get(name);
}
properties.set(name, val);
return self;
},
- removeAttr: function (name) {
+ removeAttr(name) {
attrs.delete(name);
return self;
},
- removeClass: function (class_names) {
+ removeClass(class_names) {
class_names = class_names.split(" ");
class_names.forEach((class_name) => {
classes.delete(class_name);
});
return self;
},
- remove: function () {
+ remove() {
return self;
},
removeData: noop,
- replaceWith: function () {
+ replaceWith() {
return self;
},
- scrollTop: function () {
+ scrollTop() {
return self;
},
- set_find_results: function (find_selector, jquery_object) {
+ set_find_results(find_selector, jquery_object) {
find_results.set(find_selector, jquery_object);
},
- show: function () {
+ show() {
shown = true;
return self;
},
- serializeArray: function () {
+ serializeArray() {
return self;
},
- set_parent: function (parent_elem) {
+ set_parent(parent_elem) {
my_parent = parent_elem;
},
- set_parents_result: function (selector, result) {
+ set_parents_result(selector, result) {
parents_result.set(selector, result);
},
- stop: function () {
+ stop() {
return self;
},
- text: function (...args) {
+ text(...args) {
if (args.length !== 0) {
if (args[0] !== undefined) {
text = args[0].toString();
@@ -337,28 +337,28 @@ exports.make_new_elem = function (selector, opts) {
}
return text;
},
- trigger: function (ev) {
+ trigger(ev) {
event_store.trigger(self, ev);
return self;
},
- val: function (...args) {
+ val(...args) {
if (args.length === 0) {
return value || "";
}
[value] = args;
return self;
},
- css: function (...args) {
+ css(...args) {
if (args.length === 0) {
return css || {};
}
[css] = args;
return self;
},
- visible: function () {
+ visible() {
return shown;
},
- slice: function () {
+ slice() {
return self;
},
};
diff --git a/static/js/activity.js b/static/js/activity.js
index c2c8ec4b6f..5c99bc450b 100644
--- a/static/js/activity.js
+++ b/static/js/activity.js
@@ -178,7 +178,7 @@ function send_presence_to_server(want_redraw) {
slim_presence: true,
},
idempotent: true,
- success: function (data) {
+ success(data) {
// Update Zephyr mirror activity warning
if (data.zephyr_mirror_active === false) {
$("#zephyr-mirror-error").addClass("show");
@@ -265,7 +265,7 @@ exports.reset_users = function () {
exports.narrow_for_user = function (opts) {
const user_id = buddy_list.get_key_from_li({li: opts.li});
- return exports.narrow_for_user_id({user_id: user_id});
+ return exports.narrow_for_user_id({user_id});
};
exports.narrow_for_user_id = function (opts) {
@@ -282,7 +282,7 @@ function keydown_enter_key() {
return;
}
- exports.narrow_for_user_id({user_id: user_id});
+ exports.narrow_for_user_id({user_id});
popovers.hide_all();
}
@@ -305,15 +305,15 @@ exports.set_cursor_and_filter = function () {
keydown_util.handle({
elem: $input,
handlers: {
- enter_key: function () {
+ enter_key() {
keydown_enter_key();
return true;
},
- up_arrow: function () {
+ up_arrow() {
exports.user_cursor.prev();
return true;
},
- down_arrow: function () {
+ down_arrow() {
exports.user_cursor.next();
return true;
},
diff --git a/static/js/alert_words_ui.js b/static/js/alert_words_ui.js
index c21e8bb216..76e0848295 100644
--- a/static/js/alert_words_ui.js
+++ b/static/js/alert_words_ui.js
@@ -44,14 +44,14 @@ function add_alert_word(alert_word) {
channel.post({
url: "/json/users/me/alert_words",
data: {alert_words: JSON.stringify(words_to_be_added)},
- success: function () {
+ success() {
const message = i18n.t('Alert word "__word__" added successfully!', {
word: words_to_be_added[0],
});
update_alert_word_status(message, false);
$("#create_alert_word_name").val("");
},
- error: function () {
+ error() {
update_alert_word_status(i18n.t("Error adding alert word!"), true);
},
});
@@ -63,10 +63,10 @@ function remove_alert_word(alert_word) {
channel.del({
url: "/json/users/me/alert_words",
data: {alert_words: JSON.stringify(words_to_be_removed)},
- success: function () {
+ success() {
update_alert_word_status(i18n.t("Alert word removed successfully!"), false);
},
- error: function () {
+ error() {
update_alert_word_status(i18n.t("Error removing alert word!"), true);
},
});
diff --git a/static/js/archive.js b/static/js/archive.js
index 89c687bf51..badfa4a836 100644
--- a/static/js/archive.js
+++ b/static/js/archive.js
@@ -100,18 +100,18 @@ exports.initialize = function () {
};
exports.current_msg_list = {
- selected_row: function () {
+ selected_row() {
return $(".message_row").last();
},
};
exports.rows = {
- get_message_recipient_row: function (message_row) {
+ get_message_recipient_row(message_row) {
return $(message_row).parent(".recipient_row");
},
- first_message_in_group: function (message_group) {
+ first_message_in_group(message_group) {
return $("div.message_row", message_group).first();
},
- id: function (message_row) {
+ id(message_row) {
return parseFloat(message_row.attr("zid"));
},
};
diff --git a/static/js/attachments_ui.js b/static/js/attachments_ui.js
index 8b678528da..839c45da7d 100644
--- a/static/js/attachments_ui.js
+++ b/static/js/attachments_ui.js
@@ -46,10 +46,10 @@ function delete_attachments(attachment) {
channel.del({
url: "/json/attachments/" + attachment,
idempotent: true,
- error: function (xhr) {
+ error(xhr) {
ui_report.error(i18n.t("Failed"), xhr, status);
},
- success: function () {
+ success() {
ui_report.success(i18n.t("Attachment deleted"), status);
},
});
@@ -83,15 +83,15 @@ function render_attachments_ui() {
list_render.create(uploaded_files_table, attachments, {
name: "uploaded-files-list",
- modifier: function (attachment) {
- return render_uploaded_files_list({attachment: attachment});
+ modifier(attachment) {
+ return render_uploaded_files_list({attachment});
},
filter: {
element: $search_input,
- predicate: function (item, value) {
+ predicate(item, value) {
return item.name.toLocaleLowerCase().includes(value);
},
- onupdate: function () {
+ onupdate() {
ui.reset_scrollbar(uploaded_files_table.closest(".progressive-table-wrapper"));
},
},
@@ -145,14 +145,14 @@ exports.set_up_attachments = function () {
channel.get({
url: "/json/attachments",
idempotent: true,
- success: function (data) {
+ success(data) {
loading.destroy_indicator($("#attachments_loading_indicator"));
format_attachment_data(data.attachments);
attachments = data.attachments;
upload_space_used = data.upload_space_used;
render_attachments_ui();
},
- error: function (xhr) {
+ error(xhr) {
loading.destroy_indicator($("#attachments_loading_indicator"));
ui_report.error(i18n.t("Failed"), xhr, status);
},
diff --git a/static/js/avatar.js b/static/js/avatar.js
index 7ccbbc1939..c45ad51e09 100644
--- a/static/js/avatar.js
+++ b/static/js/avatar.js
@@ -56,7 +56,7 @@ exports.build_user_avatar_widget = function (upload_function) {
e.stopPropagation();
channel.del({
url: "/json/users/me/avatar",
- success: function () {
+ success() {
$("#user-avatar-upload-widget .settings-page-delete-button").hide();
$("#user-avatar-source").show();
// Need to clear input because of a small edge case
diff --git a/static/js/billing/billing.js b/static/js/billing/billing.js
index e101700963..ca553c30bc 100644
--- a/static/js/billing/billing.js
+++ b/static/js/billing/billing.js
@@ -7,7 +7,7 @@ exports.initialize = function () {
key: stripe_key,
image: "/static/images/logo/zulip-icon-128x128.png",
locale: "auto",
- token: function (stripe_token) {
+ token(stripe_token) {
helpers.create_ajax_request("/json/billing/sources/change", "cardchange", stripe_token);
},
});
@@ -19,7 +19,7 @@ exports.initialize = function () {
zipCode: true,
billingAddress: true,
panelLabel: "Update card",
- email: email,
+ email,
label: "Update card",
allowRememberMe: false,
});
diff --git a/static/js/billing/helpers.js b/static/js/billing/helpers.js
index b366902591..5d3a33d378 100644
--- a/static/js/billing/helpers.js
+++ b/static/js/billing/helpers.js
@@ -39,9 +39,9 @@ exports.create_ajax_request = function (
});
$.post({
- url: url,
- data: data,
- success: function () {
+ url,
+ data,
+ success() {
$(form_loading).hide();
$(form_error).hide();
$(form_success).show();
@@ -54,7 +54,7 @@ exports.create_ajax_request = function (
}
window.location.replace(redirect_to);
},
- error: function (xhr) {
+ error(xhr) {
$(form_loading).hide();
$(form_error).show().text(JSON.parse(xhr.responseText).msg);
$(form_input_section).show();
diff --git a/static/js/billing/upgrade.js b/static/js/billing/upgrade.js
index d28161b607..9a1672cd5f 100644
--- a/static/js/billing/upgrade.js
+++ b/static/js/billing/upgrade.js
@@ -6,7 +6,7 @@ exports.initialize = () => {
key: $("#autopay-form").data("key"),
image: "/static/images/logo/zulip-icon-128x128.png",
locale: "auto",
- token: function (stripe_token) {
+ token(stripe_token) {
helpers.create_ajax_request("/json/billing/upgrade", "autopay", stripe_token, [
"licenses",
]);
diff --git a/static/js/blueslip.js b/static/js/blueslip.js
index b13e11925c..ca61fd4b1c 100644
--- a/static/js/blueslip.js
+++ b/static/js/blueslip.js
@@ -131,7 +131,7 @@ function report_error(msg, stack, opts) {
log: logger.get_log().join("\n"),
},
timeout: 3 * 1000,
- success: function () {
+ success() {
reported_errors.add(key);
if (opts.show_ui_msg && ui_report !== undefined) {
// There are a few races here (and below in the error
@@ -163,7 +163,7 @@ function report_error(msg, stack, opts) {
);
}
},
- error: function () {
+ error() {
if (opts.show_ui_msg && ui_report !== undefined) {
ui_report.message(
"Oops. It seems something has gone wrong. " + "Please try reloading the page.",
@@ -259,7 +259,7 @@ exports.error = function blueslip_error(msg, more_info, stack) {
}
const args = build_arg_list(msg, more_info);
logger.error(...args);
- report_error(msg, stack, {more_info: more_info});
+ report_error(msg, stack, {more_info});
if (page_params.debug_mode) {
throw new BlueslipError(msg, more_info);
@@ -267,7 +267,7 @@ exports.error = function blueslip_error(msg, more_info, stack) {
};
exports.fatal = function blueslip_fatal(msg, more_info) {
- report_error(msg, Error().stack, {more_info: more_info});
+ report_error(msg, Error().stack, {more_info});
throw new BlueslipError(msg, more_info);
};
diff --git a/static/js/buddy_data.js b/static/js/buddy_data.js
index 4824c37a40..29920bd59e 100644
--- a/static/js/buddy_data.js
+++ b/static/js/buddy_data.js
@@ -11,13 +11,13 @@ const util = require("./util");
exports.max_size_before_shrinking = 600;
const fade_config = {
- get_user_id: function (item) {
+ get_user_id(item) {
return item.user_id;
},
- fade: function (item) {
+ fade(item) {
item.faded = true;
},
- unfade: function (item) {
+ unfade(item) {
item.faded = false;
},
};
@@ -182,12 +182,12 @@ exports.info_for = function (user_id) {
return {
href: hash_util.pm_with_uri(person.email),
name: person.full_name,
- user_id: user_id,
- my_user_status: my_user_status,
+ user_id,
+ my_user_status,
is_current_user: people.is_my_user_id(user_id),
num_unread: get_num_unread(user_id),
- user_circle_class: user_circle_class,
- user_circle_status: user_circle_status,
+ user_circle_class,
+ user_circle_status,
};
};
@@ -196,7 +196,7 @@ function get_last_seen(active_status, last_seen) {
return last_seen;
}
- const last_seen_text = i18n.t("Last active: __last_seen__", {last_seen: last_seen});
+ const last_seen_text = i18n.t("Last active: __last_seen__", {last_seen});
return last_seen_text;
}
diff --git a/static/js/buddy_list.js b/static/js/buddy_list.js
index 27863b92e5..f89887c023 100644
--- a/static/js/buddy_list.js
+++ b/static/js/buddy_list.js
@@ -106,7 +106,7 @@ function buddy_list_create() {
});
const html = self.items_to_html({
- items: items,
+ items,
});
self.container = $(self.container_sel);
self.container.append(html);
@@ -194,7 +194,7 @@ function buddy_list_create() {
}
self.render_more({
- chunk_size: chunk_size,
+ chunk_size,
});
};
@@ -203,7 +203,7 @@ function buddy_list_create() {
// Try direct DOM lookup first for speed.
let li = self.get_li_from_key({
- key: key,
+ key,
});
if (li.length === 1) {
@@ -225,11 +225,11 @@ function buddy_list_create() {
}
self.force_render({
- pos: pos,
+ pos,
});
li = self.get_li_from_key({
- key: key,
+ key,
});
return li;
@@ -261,10 +261,10 @@ function buddy_list_create() {
const key = opts.key;
const item = opts.item;
- self.maybe_remove_key({key: key});
+ self.maybe_remove_key({key});
const pos = self.find_position({
- key: key,
+ key,
});
// Order is important here--get the other_key
@@ -274,11 +274,11 @@ function buddy_list_create() {
self.keys.splice(pos, 0, key);
- const html = self.item_to_html({item: item});
+ const html = self.item_to_html({item});
self.insert_new_html({
- pos: pos,
- html: html,
- other_key: other_key,
+ pos,
+ html,
+ other_key,
});
};
@@ -301,7 +301,7 @@ function buddy_list_create() {
const chunk_size = 20;
self.render_more({
- chunk_size: chunk_size,
+ chunk_size,
});
}
};
diff --git a/static/js/channel.js b/static/js/channel.js
index 788844452d..23db2598b0 100644
--- a/static/js/channel.js
+++ b/static/js/channel.js
@@ -56,7 +56,7 @@ function call(args, idempotent) {
} catch (ex) {
blueslip.error(
"Unexpected 403 response from server",
- {xhr: xhr.responseText, args: args},
+ {xhr: xhr.responseText, args},
ex.stack,
);
}
diff --git a/static/js/click_handlers.js b/static/js/click_handlers.js
index 28e7a6c3d7..2d5a75355d 100644
--- a/static/js/click_handlers.js
+++ b/static/js/click_handlers.js
@@ -216,7 +216,7 @@ exports.initialize = function () {
const title = reactions.get_reaction_title_data(message_id, local_id);
elem.tooltip({
- title: title,
+ title,
trigger: "hover",
placement: "bottom",
animation: false,
@@ -495,7 +495,7 @@ exports.initialize = function () {
.on("click", ".selectable_sidebar_block", (e) => {
const li = $(e.target).parents("li");
- activity.narrow_for_user({li: li});
+ activity.narrow_for_user({li});
e.preventDefault();
e.stopPropagation();
@@ -724,7 +724,7 @@ exports.initialize = function () {
relay_url: "https://webathena.mit.edu/relay.html",
params: {
realm: "ATHENA.MIT.EDU",
- principal: principal,
+ principal,
},
},
(err, r) => {
@@ -740,10 +740,10 @@ exports.initialize = function () {
channel.post({
url: "/accounts/webathena_kerberos_login/",
data: {cred: JSON.stringify(r.session)},
- success: function () {
+ success() {
$("#zephyr-mirror-error").removeClass("show");
},
- error: function () {
+ error() {
$("#zephyr-mirror-error").addClass("show");
},
});
diff --git a/static/js/components.js b/static/js/components.js
index a973c01e6c..dd71507660 100644
--- a/static/js/components.js
+++ b/static/js/components.js
@@ -104,28 +104,28 @@ exports.toggle = function (opts) {
})();
const prototype = {
- maybe_go_left: maybe_go_left,
- maybe_go_right: maybe_go_right,
+ maybe_go_left,
+ maybe_go_right,
- disable_tab: function (name) {
+ disable_tab(name) {
const value = opts.values.find((o) => o.key === name);
const idx = opts.values.indexOf(value);
meta.$ind_tab.eq(idx).addClass("disabled");
},
- value: function () {
+ value() {
if (meta.idx >= 0) {
return opts.values[meta.idx].label;
}
},
- get: function () {
+ get() {
return component;
},
// go through the process of finding the correct tab for a given name,
// and when found, select that one and provide the proper callback.
- goto: function (name) {
+ goto(name) {
const value = opts.values.find((o) => o.label === name || o.key === name);
const idx = opts.values.indexOf(value);
diff --git a/static/js/compose.js b/static/js/compose.js
index a662256926..f64d5b27ed 100644
--- a/static/js/compose.js
+++ b/static/js/compose.js
@@ -203,7 +203,7 @@ function create_message_object() {
// Changes here must also be kept in sync with echo.try_deliver_locally
const message = {
type: compose_state.get_message_type(),
- content: content,
+ content,
sender_id: page_params.user_id,
queue_id: page_params.queue_id,
stream: "",
@@ -342,8 +342,8 @@ exports.send_message = function send_message(request) {
request.local_id = local_id;
sent_messages.start_tracking_message({
- local_id: local_id,
- locally_echoed: locally_echoed,
+ local_id,
+ locally_echoed,
});
request.locally_echoed = locally_echoed;
@@ -457,14 +457,14 @@ function check_unsubscribed_stream_for_send(stream_name, autosubscribe) {
url: "/json/subscriptions/exists",
data: {stream: stream_name, autosubscribe: true},
async: false,
- success: function (data) {
+ success(data) {
if (data.subscribed) {
result = "subscribed";
} else {
result = "not-subscribed";
}
},
- error: function (xhr) {
+ error(xhr) {
if (xhr.status === 404) {
result = "does-not-exist";
} else {
@@ -546,7 +546,7 @@ function validate_stream_message_post_policy(sub) {
) {
error_text = i18n.t(
"New members are not allowed to post to this stream.
Permission will be granted in __days__ days.",
- {days: days},
+ {days},
);
compose_error(error_text);
return false;
@@ -867,14 +867,14 @@ exports.render_and_show_preview = function (preview_spinner, preview_content_box
channel.post({
url: "/json/messages/render",
idempotent: true,
- data: {content: content},
- success: function (response_data) {
+ data: {content},
+ success(response_data) {
if (markdown.contains_backend_only_syntax(content)) {
loading.destroy_indicator(preview_spinner);
}
show_preview(response_data.rendered, content);
},
- error: function () {
+ error() {
if (markdown.contains_backend_only_syntax(content)) {
loading.destroy_indicator(preview_spinner);
}
@@ -923,7 +923,7 @@ exports.warn_if_private_stream_is_linked = function (linked_stream) {
const stream_name = linked_stream.name;
const warning_area = $("#compose_private_stream_alert");
- const context = {stream_name: stream_name};
+ const context = {stream_name};
const new_row = render_compose_private_stream_alert(context);
warning_area.append(new_row);
@@ -968,7 +968,7 @@ exports.warn_if_mentioning_unsubscribed_user = function (mentioned) {
if (!existing_invites.includes(user_id)) {
const context = {
- user_id: user_id,
+ user_id,
stream_id: sub.stream_id,
name: mentioned.full_name,
can_subscribe_other_users: page_params.can_subscribe_other_users,
@@ -1182,7 +1182,7 @@ exports.initialize = function () {
) {
channel.get({
url: "/json/calls/bigbluebutton/create",
- success: function (response) {
+ success(response) {
insert_video_call_url(response.url, target_textarea);
},
});
diff --git a/static/js/compose_actions.js b/static/js/compose_actions.js
index c4827d5491..c4deb8b2fe 100644
--- a/static/js/compose_actions.js
+++ b/static/js/compose_actions.js
@@ -92,7 +92,7 @@ function clear_box() {
exports.autosize_message_content = function () {
autosize($("#compose-textarea"), {
- callback: function () {
+ callback() {
exports.maybe_scroll_up_selected_message();
},
});
@@ -328,8 +328,8 @@ exports.respond_to_message = function (opts) {
}
exports.start(msg_type, {
- stream: stream,
- topic: topic,
+ stream,
+ topic,
private_message_recipient: pm_recipient,
trigger: opts.trigger,
});
@@ -438,7 +438,7 @@ exports.quote_and_reply = function (opts) {
channel.get({
url: "/json/messages/" + message_id,
idempotent: true,
- success: function (data) {
+ success(data) {
message.raw_content = data.raw_content;
replace_content(message);
},
diff --git a/static/js/compose_fade.js b/static/js/compose_fade.js
index f5b4feae14..65e65c707c 100644
--- a/static/js/compose_fade.js
+++ b/static/js/compose_fade.js
@@ -119,13 +119,13 @@ exports.would_receive_message = function (user_id) {
};
const user_fade_config = {
- get_user_id: function (li) {
- return buddy_list.get_key_from_li({li: li});
+ get_user_id(li) {
+ return buddy_list.get_key_from_li({li});
},
- fade: function (li) {
+ fade(li) {
return li.addClass("user-fade");
},
- unfade: function (li) {
+ unfade(li) {
return li.removeClass("user-fade");
},
};
diff --git a/static/js/compose_pm_pill.js b/static/js/compose_pm_pill.js
index 13ac9efed1..2a0b78a51f 100644
--- a/static/js/compose_pm_pill.js
+++ b/static/js/compose_pm_pill.js
@@ -3,7 +3,7 @@ exports.initialize_pill = function () {
const container = $("#private_message_recipient").parent();
const pill = input_pill.create({
- container: container,
+ container,
create_item_from_text: user_pill.create_item_from_email,
get_text_from_item: user_pill.get_email_from_item,
});
@@ -23,7 +23,7 @@ exports.set_from_typeahead = function (person) {
// We expect person to be an object returned from people.js.
user_pill.append_person({
pill_widget: exports.widget,
- person: person,
+ person,
});
};
diff --git a/static/js/compose_ui.js b/static/js/compose_ui.js
index ac1784d4f4..3cb876d715 100644
--- a/static/js/compose_ui.js
+++ b/static/js/compose_ui.js
@@ -119,7 +119,7 @@ exports.compute_placeholder_text = function (opts) {
});
}
}
- return i18n.t("Message __- recipient_names__", {recipient_names: recipient_names});
+ return i18n.t("Message __- recipient_names__", {recipient_names});
}
return i18n.t("Compose your message here");
};
diff --git a/static/js/composebox_typeahead.js b/static/js/composebox_typeahead.js
index 19a7ae0a9d..e9d529114d 100644
--- a/static/js/composebox_typeahead.js
+++ b/static/js/composebox_typeahead.js
@@ -99,7 +99,7 @@ function get_topic_matcher(query) {
return function (topic) {
const obj = {
- topic: topic,
+ topic,
};
return typeahead.query_matches_source_attrs(query, obj, ["topic"], " ");
@@ -366,7 +366,7 @@ exports.broadcast_mentions = function () {
is_broadcast: true,
// used for sorting
- idx: idx,
+ idx,
}));
};
@@ -677,7 +677,7 @@ exports.get_candidates = function (query) {
return false;
}
this.token = current_token;
- return {is_silent: is_silent};
+ return {is_silent};
}
function get_slash_commands_data() {
@@ -1041,15 +1041,15 @@ exports.initialize_compose_typeahead = function (selector) {
// inside the typeahead library.
source: exports.get_sorted_filtered_items,
highlighter: exports.content_highlighter,
- matcher: function () {
+ matcher() {
return true;
},
- sorter: function (items) {
+ sorter(items) {
return items;
},
updater: exports.content_typeahead_selected,
stopAdvance: true, // Do not advance to the next field on a tab or enter
- completions: completions,
+ completions,
automated: exports.compose_automated_selection,
trigger_selection: exports.compose_trigger_selection,
header: get_header_text,
@@ -1092,15 +1092,15 @@ exports.initialize = function () {
// limit number of items so the list doesn't fall off the screen
$("#stream_message_recipient_stream").typeahead({
- source: function () {
+ source() {
return stream_data.subscribed_streams();
},
items: 3,
fixed: true,
- highlighter: function (item) {
+ highlighter(item) {
return typeahead_helper.render_typeahead_item({primary: item});
},
- matcher: function (item) {
+ matcher(item) {
// The matcher for "stream" is strictly prefix-based,
// because we want to avoid mixing up streams.
const q = this.query.trim().toLowerCase();
@@ -1109,16 +1109,16 @@ exports.initialize = function () {
});
$("#stream_message_recipient_topic").typeahead({
- source: function () {
+ source() {
const stream_name = compose_state.stream_name();
return exports.topics_seen_for(stream_name);
},
items: 3,
fixed: true,
- highlighter: function (item) {
+ highlighter(item) {
return typeahead_helper.render_typeahead_item({primary: item});
},
- sorter: function (items) {
+ sorter(items) {
const sorted = typeahead_helper.sorter(this.query, items, (x) => x);
if (sorted.length > 0 && !sorted.includes(this.query)) {
sorted.unshift(this.query);
@@ -1132,16 +1132,16 @@ exports.initialize = function () {
items: exports.max_num_items,
dropup: true,
fixed: true,
- highlighter: function (item) {
+ highlighter(item) {
return typeahead_helper.render_person_or_user_group(item);
},
- matcher: function () {
+ matcher() {
return true;
},
- sorter: function (items) {
+ sorter(items) {
return items;
},
- updater: function (item) {
+ updater(item) {
if (user_groups.is_user_group(item)) {
for (const user_id of item.members) {
const user = people.get_by_user_id(user_id);
diff --git a/static/js/copy_and_paste.js b/static/js/copy_and_paste.js
index 4376b70708..0976d370db 100644
--- a/static/js/copy_and_paste.js
+++ b/static/js/copy_and_paste.js
@@ -257,10 +257,10 @@ exports.analyze_selection = function (selection) {
}
return {
- ranges: ranges,
- start_id: start_id,
- end_id: end_id,
- skip_same_td_check: skip_same_td_check,
+ ranges,
+ start_id,
+ end_id,
+ skip_same_td_check,
};
};
@@ -268,24 +268,24 @@ exports.paste_handler_converter = function (paste_html) {
const turndownService = new TurndownService();
turndownService.addRule("headings", {
filter: ["h1", "h2", "h3", "h4", "h5", "h6"],
- replacement: function (content) {
+ replacement(content) {
return content;
},
});
turndownService.addRule("emphasis", {
filter: ["em", "i"],
- replacement: function (content) {
+ replacement(content) {
return "*" + content + "*";
},
});
// Checks for raw links without custom text or title.
turndownService.addRule("links", {
- filter: function (node) {
+ filter(node) {
return (
node.nodeName === "A" && node.href === node.innerHTML && node.href === node.title
);
},
- replacement: function (content) {
+ replacement(content) {
return content;
},
});
diff --git a/static/js/csrf.js b/static/js/csrf.js
index e51831e984..cb237511d8 100644
--- a/static/js/csrf.js
+++ b/static/js/csrf.js
@@ -14,7 +14,7 @@ $(() => {
}
$.ajaxSetup({
- beforeSend: function (xhr, settings) {
+ beforeSend(xhr, settings) {
if (!(/^http:.*/.test(settings.url) || /^https:.*/.test(settings.url))) {
// Only send the token to relative URLs i.e. locally.
xhr.setRequestHeader("X-CSRFToken", csrf_token);
diff --git a/static/js/debug.js b/static/js/debug.js
index 69be7ee8ba..3aab52f2da 100644
--- a/static/js/debug.js
+++ b/static/js/debug.js
@@ -63,8 +63,8 @@ export function check_duplicate_ids() {
});
return {
- collisions: collisions,
- total_collisions: total_collisions,
+ collisions,
+ total_collisions,
};
}
@@ -104,11 +104,11 @@ export function IterationProfiler() {
}
IterationProfiler.prototype = {
- iteration_start: function () {
+ iteration_start() {
this.section("_iteration_overhead");
},
- iteration_stop: function () {
+ iteration_stop() {
const now = window.performance.now();
const diff = now - this.last_time;
if (diff > 1) {
@@ -120,13 +120,13 @@ IterationProfiler.prototype = {
this.last_time = now;
},
- section: function (label) {
+ section(label) {
const now = window.performance.now();
this.sections.set(label, (this.sections.get(label) || 0) + (now - this.last_time));
this.last_time = now;
},
- done: function () {
+ done() {
this.section("_iteration_overhead");
for (const [prop, cost] of this.sections) {
diff --git a/static/js/drafts.js b/static/js/drafts.js
index ead9c7bb65..1d48907bac 100644
--- a/static/js/drafts.js
+++ b/static/js/drafts.js
@@ -3,7 +3,7 @@ const render_draft_table_body = require("../templates/draft_table_body.hbs");
function set_count(count) {
const draft_count = count.toString();
- const text = i18n.t("Drafts (__draft_count__)", {draft_count: draft_count});
+ const text = i18n.t("Drafts (__draft_count__)", {draft_count});
$(".compose_drafts_button").text(text);
}
@@ -233,12 +233,12 @@ exports.format_draft = function (draft) {
formatted = {
draft_id: draft.id,
is_stream: true,
- stream: stream,
+ stream,
stream_color: draft_stream_color,
dark_background: stream_color.get_color_class(draft_stream_color),
topic: draft_topic,
raw_content: draft.content,
- time_stamp: time_stamp,
+ time_stamp,
};
} else {
const emails = util.extract_pm_recipients(draft.private_message_recipient);
@@ -256,9 +256,9 @@ exports.format_draft = function (draft) {
formatted = {
draft_id: draft.id,
is_stream: false,
- recipients: recipients,
+ recipients,
raw_content: draft.content,
- time_stamp: time_stamp,
+ time_stamp,
};
}
@@ -333,7 +333,7 @@ exports.launch = function () {
function render_widgets(drafts) {
$("#drafts_table").empty();
const rendered = render_draft_table_body({
- drafts: drafts,
+ drafts,
draft_lifetime: DRAFT_LIFETIME,
});
$("#drafts_table").append(rendered);
@@ -508,7 +508,7 @@ exports.open_overlay = function () {
overlays.open_overlay({
name: "drafts",
overlay: $("#draft_overlay"),
- on_close: function () {
+ on_close() {
hashchange.exit_overlay();
},
});
diff --git a/static/js/dropdown_list_widget.js b/static/js/dropdown_list_widget.js
index ff9f5dd0f3..9c5cb55768 100644
--- a/static/js/dropdown_list_widget.js
+++ b/static/js/dropdown_list_widget.js
@@ -74,12 +74,12 @@ const DropdownListWidget = function (opts) {
list_render.create(dropdown_list_body, opts.data, {
name: `${opts.widget_name}_list`,
- modifier: function (item) {
- return render_dropdown_list({item: item});
+ modifier(item) {
+ return render_dropdown_list({item});
},
filter: {
element: search_input,
- predicate: function (item, value) {
+ predicate(item, value) {
return item.name.toLowerCase().includes(value);
},
},
diff --git a/static/js/echo.js b/static/js/echo.js
index db6c6de03a..4b7dbebcee 100644
--- a/static/js/echo.js
+++ b/static/js/echo.js
@@ -72,7 +72,7 @@ exports.build_display_recipient = function (message) {
// the requirement that we have an actual user object in
// `people.js` when sending messages.
return {
- email: email,
+ email,
full_name: email,
unknown_local_echo_user: true,
};
diff --git a/static/js/emoji.js b/static/js/emoji.js
index 41345a4272..e4a62f610b 100644
--- a/static/js/emoji.js
+++ b/static/js/emoji.js
@@ -39,8 +39,8 @@ const emoticon_translations = (() => {
const regex = new RegExp("(" + util.escape_regexp(emoticon) + ")", "g");
translations.push({
- regex: regex,
- replacement_text: replacement_text,
+ regex,
+ replacement_text,
});
}
diff --git a/static/js/emoji_picker.js b/static/js/emoji_picker.js
index 3b757a5dd4..939faa92c7 100644
--- a/static/js/emoji_picker.js
+++ b/static/js/emoji_picker.js
@@ -225,7 +225,7 @@ function filter_emojis() {
const sorted_search_results = typeahead.sort_emojis(search_results, query);
const rendered_search_results = render_emoji_popover_search_results({
search_results: sorted_search_results,
- message_id: message_id,
+ message_id,
});
$(".emoji-search-results").html(rendered_search_results);
ui.reset_scrollbar($(".emoji-search-results-container"));
@@ -306,7 +306,7 @@ function update_emoji_showcase($focused_emoji) {
name: focused_emoji_name.replace(/_/g, " "),
};
const rendered_showcase = render_emoji_showcase({
- emoji_dict: emoji_dict,
+ emoji_dict,
});
$(".emoji-showcase-container").html(rendered_showcase);
@@ -596,9 +596,9 @@ exports.render_emoji_popover = function (elt, id) {
elt.popover({
// temporary patch for handling popover placement of `viewport_center`
- placement: placement,
+ placement,
fix_positions: true,
- template: template,
+ template,
title: "",
content: generate_emoji_picker_content(id),
html: true,
diff --git a/static/js/feedback_widget.js b/static/js/feedback_widget.js
index cbb7b98978..c25293910a 100644
--- a/static/js/feedback_widget.js
+++ b/static/js/feedback_widget.js
@@ -26,7 +26,7 @@ const meta = {
};
const animate = {
- maybe_close: function () {
+ maybe_close() {
if (!meta.opened) {
return;
}
@@ -38,7 +38,7 @@ const animate = {
setTimeout(animate.maybe_close, 100);
},
- fadeOut: function () {
+ fadeOut() {
if (!meta.opened) {
return;
}
@@ -49,7 +49,7 @@ const animate = {
meta.alert_hover_state = false;
}
},
- fadeIn: function () {
+ fadeIn() {
if (meta.opened) {
return;
}
diff --git a/static/js/fenced_code.js b/static/js/fenced_code.js
index bb47e9ddcc..80fd6e63d4 100644
--- a/static/js/fenced_code.js
+++ b/static/js/fenced_code.js
@@ -97,7 +97,7 @@ exports.process_fenced_code = function (content) {
const lines = [];
if (lang === "quote") {
return {
- handle_line: function (line) {
+ handle_line(line) {
if (line === fence) {
this.done();
} else {
@@ -105,7 +105,7 @@ exports.process_fenced_code = function (content) {
}
},
- done: function () {
+ done() {
const text = wrap_quote(lines.join("\n"));
output_lines.push("");
output_lines.push(text);
@@ -117,7 +117,7 @@ exports.process_fenced_code = function (content) {
if (lang === "math") {
return {
- handle_line: function (line) {
+ handle_line(line) {
if (line === fence) {
this.done();
} else {
@@ -125,7 +125,7 @@ exports.process_fenced_code = function (content) {
}
},
- done: function () {
+ done() {
const text = wrap_tex(lines.join("\n"));
const placeholder = stash_func(text, true);
output_lines.push("");
@@ -138,7 +138,7 @@ exports.process_fenced_code = function (content) {
if (lang === "spoiler") {
return {
- handle_line: function (line) {
+ handle_line(line) {
if (line === fence) {
this.done();
} else {
@@ -146,7 +146,7 @@ exports.process_fenced_code = function (content) {
}
},
- done: function () {
+ done() {
const text = wrap_spoiler(header, lines.join("\n"), stash_func);
output_lines.push("");
output_lines.push(text);
@@ -157,7 +157,7 @@ exports.process_fenced_code = function (content) {
}
return {
- handle_line: function (line) {
+ handle_line(line) {
if (line === fence) {
this.done();
} else {
@@ -165,7 +165,7 @@ exports.process_fenced_code = function (content) {
}
},
- done: function () {
+ done() {
const text = exports.wrap_code(lines.join("\n"));
// insert safe HTML that is passed through the parsing
const placeholder = stash_func(text, true);
@@ -180,10 +180,10 @@ exports.process_fenced_code = function (content) {
function default_hander() {
return {
- handle_line: function (line) {
+ handle_line(line) {
consume_line(output, line);
},
- done: function () {
+ done() {
handler_stack.pop();
},
};
diff --git a/static/js/filter.js b/static/js/filter.js
index e5a68be623..b7525a2aaa 100644
--- a/static/js/filter.js
+++ b/static/js/filter.js
@@ -243,9 +243,9 @@ Filter.canonicalize_term = function (opts) {
// We may want to consider allowing mixed-case operators at some point
return {
- negated: negated,
- operator: operator,
- operand: operand,
+ negated,
+ operator,
+ operand,
};
};
@@ -313,7 +313,7 @@ Filter.parse = function (str) {
search_term.push(token);
continue;
}
- term = {negated: negated, operator: operator, operand: operand};
+ term = {negated, operator, operand};
operators.push(term);
}
}
@@ -322,7 +322,7 @@ Filter.parse = function (str) {
if (search_term.length > 0) {
operator = "search";
operand = search_term.join(" ");
- term = {operator: operator, operand: operand, negated: false};
+ term = {operator, operand, negated: false};
operators.push(term);
}
return operators;
@@ -354,18 +354,18 @@ Filter.unparse = function (operators) {
};
Filter.prototype = {
- predicate: function () {
+ predicate() {
if (this._predicate === undefined) {
this._predicate = this._build_predicate();
}
return this._predicate;
},
- operators: function () {
+ operators() {
return this._operators;
},
- public_operators: function () {
+ public_operators() {
const safe_to_return = this._operators.filter(
// Filter out the embedded narrow (if any).
(value) =>
@@ -378,26 +378,26 @@ Filter.prototype = {
return safe_to_return;
},
- operands: function (operator) {
+ operands(operator) {
return _.chain(this._operators)
.filter((elem) => !elem.negated && elem.operator === operator)
.map((elem) => elem.operand)
.value();
},
- has_negated_operand: function (operator, operand) {
+ has_negated_operand(operator, operand) {
return this._operators.some(
(elem) => elem.negated && elem.operator === operator && elem.operand === operand,
);
},
- has_operand: function (operator, operand) {
+ has_operand(operator, operand) {
return this._operators.some(
(elem) => !elem.negated && elem.operator === operator && elem.operand === operand,
);
},
- has_operator: function (operator) {
+ has_operator(operator) {
return this._operators.some((elem) => {
if (elem.negated && !["search", "has"].includes(elem.operator)) {
return false;
@@ -406,11 +406,11 @@ Filter.prototype = {
});
},
- is_search: function () {
+ is_search() {
return this.has_operator("search");
},
- calc_can_mark_messages_read: function () {
+ calc_can_mark_messages_read() {
const term_types = this.sorted_term_types();
if (_.isEqual(term_types, ["stream", "topic"])) {
@@ -450,7 +450,7 @@ Filter.prototype = {
return false;
},
- can_mark_messages_read: function () {
+ can_mark_messages_read() {
if (this._can_mark_messages_read === undefined) {
this._can_mark_messages_read = this.calc_can_mark_messages_read();
}
@@ -467,7 +467,7 @@ Filter.prototype = {
// TODO: We likely will want to rewrite this to not piggy-back on
// can_mark_messages_read, since that might gain some more complex behavior
// with near: narrows.
- is_common_narrow: function () {
+ is_common_narrow() {
// can_mark_messages_read tests the following filters:
// stream, stream + topic,
// is: private, pm-with:,
@@ -496,7 +496,7 @@ Filter.prototype = {
//
// Note from tabbott: The slug-based approach may not be ideal; we
// may be able to do better another way.
- generate_redirect_url: function () {
+ generate_redirect_url() {
const term_types = this.sorted_term_types();
// this comes first because it has 3 term_types but is not a "complex filter"
@@ -551,7 +551,7 @@ Filter.prototype = {
return "#"; // redirect to All
},
- get_icon: function () {
+ get_icon() {
// We have special icons for the simple narrows available for the via sidebars.
const term_types = this.sorted_term_types();
switch (term_types[0]) {
@@ -580,7 +580,7 @@ Filter.prototype = {
}
},
- get_title: function () {
+ get_title() {
// Nice explanatory titles for common views.
const term_types = this.sorted_term_types();
if (
@@ -629,11 +629,11 @@ Filter.prototype = {
}
},
- allow_use_first_unread_when_narrowing: function () {
+ allow_use_first_unread_when_narrowing() {
return this.can_mark_messages_read() || this.has_operator("is");
},
- contains_only_private_messages: function () {
+ contains_only_private_messages() {
return (
(this.has_operator("is") && this.operands("is")[0] === "private") ||
this.has_operator("pm-with") ||
@@ -641,11 +641,11 @@ Filter.prototype = {
);
},
- includes_full_stream_history: function () {
+ includes_full_stream_history() {
return this.has_operator("stream") || this.has_operator("streams");
},
- is_personal_filter: function () {
+ is_personal_filter() {
// Whether the filter filters for user-specific data in the
// UserMessage table, such as stars or mentions.
//
@@ -654,7 +654,7 @@ Filter.prototype = {
return this.has_operand("is", "mentioned") || this.has_operand("is", "starred");
},
- can_apply_locally: function (is_local_echo) {
+ can_apply_locally(is_local_echo) {
// Since there can be multiple operators, each block should
// just return false here.
@@ -682,13 +682,13 @@ Filter.prototype = {
return true;
},
- fix_operators: function (operators) {
+ fix_operators(operators) {
operators = this._canonicalize_operators(operators);
operators = this._fix_redundant_is_private(operators);
return operators;
},
- _fix_redundant_is_private: function (terms) {
+ _fix_redundant_is_private(terms) {
const is_pm_with = (term) => Filter.term_type(term) === "pm-with";
if (!terms.some(is_pm_with)) {
@@ -698,11 +698,11 @@ Filter.prototype = {
return terms.filter((term) => Filter.term_type(term) !== "is-private");
},
- _canonicalize_operators: function (operators_mixed_case) {
+ _canonicalize_operators(operators_mixed_case) {
return operators_mixed_case.map((tuple) => Filter.canonicalize_term(tuple));
},
- filter_with_new_params: function (params) {
+ filter_with_new_params(params) {
const terms = this._operators.map((term) => {
const new_term = {...term};
if (new_term.operator === params.operator && !new_term.negated) {
@@ -713,25 +713,25 @@ Filter.prototype = {
return new Filter(terms);
},
- has_topic: function (stream_name, topic) {
+ has_topic(stream_name, topic) {
return this.has_operand("stream", stream_name) && this.has_operand("topic", topic);
},
- sorted_term_types: function () {
+ sorted_term_types() {
if (this._sorted_term_types === undefined) {
this._sorted_term_types = this._build_sorted_term_types();
}
return this._sorted_term_types;
},
- _build_sorted_term_types: function () {
+ _build_sorted_term_types() {
const terms = this._operators;
const term_types = terms.map(Filter.term_type);
const sorted_terms = Filter.sorted_term_types(term_types);
return sorted_terms;
},
- can_bucket_by: function (...wanted_term_types) {
+ can_bucket_by(...wanted_term_types) {
// Examples call:
// filter.can_bucket_by('stream', 'topic')
//
@@ -748,7 +748,7 @@ Filter.prototype = {
return _.isEqual(term_types, wanted_term_types);
},
- first_valid_id_from: function (msg_ids) {
+ first_valid_id_from(msg_ids) {
const predicate = this.predicate();
const first_id = msg_ids.find((msg_id) => {
@@ -764,7 +764,7 @@ Filter.prototype = {
return first_id;
},
- update_email: function (user_id, new_email) {
+ update_email(user_id, new_email) {
for (const term of this._operators) {
switch (term.operator) {
case "group-pm-with":
@@ -781,7 +781,7 @@ Filter.prototype = {
},
// Build a filter function from a list of operators.
- _build_predicate: function () {
+ _build_predicate() {
const operators = this._operators;
if (!this.can_apply_locally()) {
diff --git a/static/js/floating_recipient_bar.js b/static/js/floating_recipient_bar.js
index 13ad251bb0..50bc3087c3 100644
--- a/static/js/floating_recipient_bar.js
+++ b/static/js/floating_recipient_bar.js
@@ -192,11 +192,11 @@ exports.relevant_recipient_bars = function () {
const title = elem.find(".message_label_clickable").last().attr("title");
const item = {
- elem: elem,
- title: title,
- date_html: date_html,
- date_text: date_text,
- need_frb: need_frb,
+ elem,
+ title,
+ date_html,
+ date_text,
+ need_frb,
};
return item;
diff --git a/static/js/hash_util.js b/static/js/hash_util.js
index 0c85d9a5e9..9a55ae5094 100644
--- a/static/js/hash_util.js
+++ b/static/js/hash_util.js
@@ -198,7 +198,7 @@ exports.parse_narrow = function (hash) {
}
const operand = exports.decode_operand(operator, raw_operand);
- operators.push({negated: negated, operator: operator, operand: operand});
+ operators.push({negated, operator, operand});
}
return operators;
};
diff --git a/static/js/hotspots.js b/static/js/hotspots.js
index 75b0558ae7..38466fd000 100644
--- a/static/js/hotspots.js
+++ b/static/js/hotspots.js
@@ -63,7 +63,7 @@ exports.post_hotspot_as_read = function (hotspot_name) {
channel.post({
url: "/json/users/me/hotspots",
data: {hotspot: JSON.stringify(hotspot_name)},
- error: function (err) {
+ error(err) {
blueslip.error(err.responseText);
},
});
diff --git a/static/js/info_overlay.js b/static/js/info_overlay.js
index 15e597cace..f63881f29a 100644
--- a/static/js/info_overlay.js
+++ b/static/js/info_overlay.js
@@ -11,7 +11,7 @@ exports.set_up_toggler = function () {
{label: i18n.t("Message formatting"), key: "message-formatting"},
{label: i18n.t("Search operators"), key: "search-operators"},
],
- callback: function (name, key) {
+ callback(name, key) {
$(".overlay-modal").hide();
$("#" + key).show();
ui.get_scroll_element($("#" + key).find(".modal-body")).trigger("focus");
@@ -55,8 +55,8 @@ exports.show = function (target) {
if (!overlay.hasClass("show")) {
overlays.open_overlay({
name: "informationalOverlays",
- overlay: overlay,
- on_close: function () {
+ overlay,
+ on_close() {
hashchange.changehash("");
},
});
diff --git a/static/js/input_pill.js b/static/js/input_pill.js
index bfb27dff3d..7826a1da27 100644
--- a/static/js/input_pill.js
+++ b/static/js/input_pill.js
@@ -46,20 +46,20 @@ exports.create = function (opts) {
// of the `this` arg in the `Function.prototype.bind` use in the prototype.
const funcs = {
// return the value of the contenteditable input form.
- value: function (input_elem) {
+ value(input_elem) {
return input_elem.innerText;
},
// clear the value of the input form.
- clear: function (input_elem) {
+ clear(input_elem) {
input_elem.innerText = "";
},
- clear_text: function () {
+ clear_text() {
store.$input.text("");
},
- is_pending: function () {
+ is_pending() {
// This function returns true if we have text
// in out widget that hasn't been turned into
// pills. We use it to decide things like
@@ -67,7 +67,7 @@ exports.create = function (opts) {
return store.$input.text().trim() !== "";
},
- create_item: function (text) {
+ create_item(text) {
const existing_items = funcs.items();
const item = store.create_item_from_text(text, existing_items);
@@ -85,7 +85,7 @@ exports.create = function (opts) {
// This is generally called by typeahead logic, where we have all
// the data we need (as opposed to, say, just a user-typed email).
- appendValidatedData: function (item) {
+ appendValidatedData(item) {
const id = exports.random_id();
if (!item.display_value) {
@@ -94,8 +94,8 @@ exports.create = function (opts) {
}
const payload = {
- id: id,
- item: item,
+ id,
+ item,
};
store.pills.push(payload);
@@ -105,7 +105,7 @@ exports.create = function (opts) {
const opts = {
id: payload.id,
display_value: item.display_value,
- has_image: has_image,
+ has_image,
};
if (has_image) {
@@ -119,7 +119,7 @@ exports.create = function (opts) {
// this appends a pill to the end of the container but before the
// input block.
- appendPill: function (value) {
+ appendPill(value) {
if (value.length === 0) {
return;
}
@@ -142,7 +142,7 @@ exports.create = function (opts) {
// from the DOM, removes it from the array and returns it.
// this would generally be used for DOM-provoked actions, such as a user
// clicking on a pill to remove it.
- removePill: function (id) {
+ removePill(id) {
let idx;
for (let x = 0; x < store.pills.length; x += 1) {
if (store.pills[x].id === id) {
@@ -166,7 +166,7 @@ exports.create = function (opts) {
// If quiet is a truthy value, the event handler associated with the
// pill will not be evaluated. This is useful when using clear to reset
// the pills.
- removeLastPill: function (quiet) {
+ removeLastPill(quiet) {
const pill = store.pills.pop();
if (pill) {
@@ -177,7 +177,7 @@ exports.create = function (opts) {
}
},
- removeAllPills: function (quiet) {
+ removeAllPills(quiet) {
while (store.pills.length > 0) {
this.removeLastPill(quiet);
}
@@ -185,7 +185,7 @@ exports.create = function (opts) {
this.clear(store.$input[0]);
},
- insertManyPills: function (pills) {
+ insertManyPills(pills) {
if (typeof pills === "string") {
pills = pills.split(/,/g).map((pill) => pill.trim());
}
@@ -216,15 +216,15 @@ exports.create = function (opts) {
}
},
- getByID: function (id) {
+ getByID(id) {
return store.pills.find((pill) => pill.id === id);
},
- items: function () {
+ items() {
return store.pills.map((pill) => pill.item);
},
- createPillonPaste: function () {
+ createPillonPaste() {
if (typeof store.createPillonPaste === "function") {
return store.createPillonPaste();
}
@@ -379,15 +379,15 @@ exports.create = function (opts) {
getByID: funcs.getByID,
items: funcs.items,
- onPillCreate: function (callback) {
+ onPillCreate(callback) {
store.onPillCreate = callback;
},
- onPillRemove: function (callback) {
+ onPillRemove(callback) {
store.removePillFunction = callback;
},
- createPillonPaste: function (callback) {
+ createPillonPaste(callback) {
store.createPillonPaste = callback;
},
diff --git a/static/js/invite.js b/static/js/invite.js
index e33dd62260..9102b75696 100644
--- a/static/js/invite.js
+++ b/static/js/invite.js
@@ -24,7 +24,7 @@ function get_common_invitation_data() {
});
const data = {
csrfmiddlewaretoken: $('input[name="csrfmiddlewaretoken"]').attr("value"),
- invite_as: invite_as,
+ invite_as,
stream_ids: JSON.stringify(stream_ids),
};
return data;
@@ -50,9 +50,9 @@ function submit_invitation_form() {
channel.post({
url: "/json/invites",
- data: data,
- beforeSend: beforeSend,
- success: function () {
+ data,
+ beforeSend,
+ success() {
ui_report.success(i18n.t("User(s) invited successfully."), invite_status);
invitee_emails_group.removeClass("warning");
invitee_emails.val("");
@@ -62,7 +62,7 @@ function submit_invitation_form() {
$("#dev_env_msg").html(rendered_email_msg).addClass("alert-info").show();
}
},
- error: function (xhr) {
+ error(xhr) {
const arr = JSON.parse(xhr.responseText);
if (arr.errors === undefined) {
// There was a fatal error, no partial processing occurred.
@@ -83,9 +83,9 @@ function submit_invitation_form() {
const error_response = render_invitation_failed_error({
error_message: arr.msg,
- error_list: error_list,
+ error_list,
is_admin: page_params.is_admin,
- is_invitee_deactivated: is_invitee_deactivated,
+ is_invitee_deactivated,
});
ui_report.message(error_response, invite_status, "alert-warning");
invitee_emails_group.addClass("warning");
@@ -95,7 +95,7 @@ function submit_invitation_form() {
}
}
},
- complete: function () {
+ complete() {
$("#submit-invitation").button("reset");
},
});
@@ -106,9 +106,9 @@ function generate_multiuse_invite() {
const data = get_common_invitation_data();
channel.post({
url: "/json/invites/multiuse",
- data: data,
- beforeSend: beforeSend,
- success: function (data) {
+ data,
+ beforeSend,
+ success(data) {
ui_report.success(
i18n.t('Invitation link: __link__', {
link: data.invite_link,
@@ -116,10 +116,10 @@ function generate_multiuse_invite() {
invite_status,
);
},
- error: function (xhr) {
+ error(xhr) {
ui_report.error("", xhr, invite_status);
},
- complete: function () {
+ complete() {
$("#submit-invitation").button("reset");
},
});
@@ -157,7 +157,7 @@ exports.launch = function () {
overlays.open_overlay({
name: "invite",
overlay: $("#invite-user"),
- on_close: function () {
+ on_close() {
hashchange.exit_overlay();
},
});
diff --git a/static/js/lightbox_canvas.js b/static/js/lightbox_canvas.js
index 64478fe3ea..d461cbf494 100644
--- a/static/js/lightbox_canvas.js
+++ b/static/js/lightbox_canvas.js
@@ -30,7 +30,7 @@ window.onload = function () {
};
const funcs = {
- setZoom: function (meta, zoom) {
+ setZoom(meta, zoom) {
// condition to handle zooming event by zoom hotkeys
if (zoom === "+") {
zoom = meta.zoom * 1.2;
@@ -43,7 +43,7 @@ const funcs = {
// this is a function given a canvas that attaches all of the events
// required to pan and zoom.
- attachEvents: function (canvas, context, meta) {
+ attachEvents(canvas, context, meta) {
let mousedown = false;
// wheelEvent.deltaMode is a value that describes what the unit is
@@ -174,28 +174,28 @@ const funcs = {
// these are less reliable as preventDefault may prevent these events
// from propagating all the way to the .
events.documentMouseup.push({
- canvas: canvas,
- meta: meta,
- callback: function () {
+ canvas,
+ meta,
+ callback() {
mousedown = false;
},
});
events.windowResize.push({
- canvas: canvas,
- meta: meta,
- callback: function () {
+ canvas,
+ meta,
+ callback() {
funcs.sizeCanvas(canvas, meta);
funcs.displayImage(canvas, context, meta);
},
});
},
- imageRatio: function (image) {
+ imageRatio(image) {
return image.naturalWidth / image.naturalHeight;
},
- displayImage: function (canvas, context, meta) {
+ displayImage(canvas, context, meta) {
meta.coords.x = Math.max(1 / (meta.zoom * 2), meta.coords.x);
meta.coords.x = Math.min(1 - 1 / (meta.zoom * 2), meta.coords.x);
@@ -225,7 +225,7 @@ const funcs = {
// as we can, which means that we check if having the photo width = 100%
// means that the height is less than 100% of the parent height. If so,
// then we size the photo as w = 100%, h = 100% / 1.5.
- sizeCanvas: function (canvas, meta) {
+ sizeCanvas(canvas, meta) {
if (canvas.parentNode === null) {
return;
}
@@ -303,25 +303,25 @@ const LightboxCanvas = function (el) {
LightboxCanvas.prototype = {
// set the speed at which scrolling zooms in on a photo.
- speed: function (speed) {
+ speed(speed) {
this.meta.speed = speed;
},
// set the max zoom of the `LightboxCanvas` canvas as a mult of the total width.
- maxZoom: function (maxZoom) {
+ maxZoom(maxZoom) {
this.meta.maxZoom = maxZoom;
},
- reverseScrollDirection: function () {
+ reverseScrollDirection() {
this.meta.direction = 1;
},
- setZoom: function (zoom) {
+ setZoom(zoom) {
funcs.setZoom(this.meta, zoom);
funcs.displayImage(this.canvas, this.context, this.meta);
},
- resize: function (callback) {
+ resize(callback) {
this.meta.onresize = callback;
},
};
diff --git a/static/js/list_cursor.js b/static/js/list_cursor.js
index ffc4c0ac93..008711c7b7 100644
--- a/static/js/list_cursor.js
+++ b/static/js/list_cursor.js
@@ -42,7 +42,7 @@ const list_cursor = function (opts) {
}
const li = opts.list.find_li({
- key: key,
+ key,
force_render: true,
});
@@ -51,11 +51,11 @@ const list_cursor = function (opts) {
}
return {
- highlight: function () {
+ highlight() {
li.addClass(opts.highlight_class);
self.adjust_scroll(li);
},
- clear: function () {
+ clear() {
li.removeClass(opts.highlight_class);
},
};
diff --git a/static/js/list_render.js b/static/js/list_render.js
index dbc6b134ae..b317b4f316 100644
--- a/static/js/list_render.js
+++ b/static/js/list_render.js
@@ -140,7 +140,7 @@ exports.create = function ($container, list, opts) {
numeric: exports.numeric_sort,
},
offset: 0,
- list: list,
+ list,
filtered_list: list,
reverse_mode: false,
filter_value: "",
diff --git a/static/js/localstorage.js b/static/js/localstorage.js
index 1efd1f7476..25081605cd 100644
--- a/static/js/localstorage.js
+++ b/static/js/localstorage.js
@@ -1,6 +1,6 @@
const ls = {
// parse JSON without throwing an error.
- parseJSON: function (str) {
+ parseJSON(str) {
try {
return JSON.parse(str);
} catch (err) {
@@ -9,26 +9,26 @@ const ls = {
},
// check if the datestamp is from before now and if so return true.
- isExpired: function (stamp) {
+ isExpired(stamp) {
return new Date(stamp) < new Date();
},
// return the localStorage key that is bound to a version of a key.
- formGetter: function (version, name) {
+ formGetter(version, name) {
return "ls__" + version + "__" + name;
},
// create a formData object to put in the data, a signature that it was
// created with this library, and when it expires (if ever).
- formData: function (data, expires) {
+ formData(data, expires) {
return {
- data: data,
+ data,
__valid: true,
expires: new Date().getTime() + expires,
};
},
- getData: function (version, name) {
+ getData(version, name) {
const key = this.formGetter(version, name);
let data = localStorage.getItem(key);
data = ls.parseJSON(data);
@@ -45,7 +45,7 @@ const ls = {
},
// set the wrapped version of the data into localStorage.
- setData: function (version, name, data, expires) {
+ setData(version, name, data, expires) {
const key = this.formGetter(version, name);
const val = this.formData(data, expires);
@@ -53,14 +53,14 @@ const ls = {
},
// remove the key from localStorage and from memory.
- removeData: function (version, name) {
+ removeData(version, name) {
const key = this.formGetter(version, name);
localStorage.removeItem(key);
},
// Remove keys which match a regex.
- removeDataRegex: function (version, regex) {
+ removeDataRegex(version, regex) {
const key_regex = new RegExp(this.formGetter(version, regex));
const keys = Object.keys(localStorage).filter((key) => key_regex.test(key));
@@ -71,7 +71,7 @@ const ls = {
// migrate from an older version of a data src to a newer one with a
// specified callback function.
- migrate: function (name, v1, v2, callback) {
+ migrate(name, v1, v2, callback) {
const old = this.getData(v1, name);
this.removeData(v1, name);
@@ -96,14 +96,14 @@ const localstorage = function () {
// `expires` should be a Number that represents the number of ms from
// now that this should expire in.
// this allows for it to either be set only once or permanently.
- setExpiry: function (expires, isGlobal) {
+ setExpiry(expires, isGlobal) {
_data.expires = expires;
_data.expiresIsGlobal = isGlobal || false;
return this;
},
- get: function (name) {
+ get(name) {
const data = ls.getData(_data.VERSION, name);
if (data) {
@@ -111,7 +111,7 @@ const localstorage = function () {
}
},
- set: function (name, data) {
+ set(name, data) {
if (typeof _data.VERSION !== "undefined") {
ls.setData(_data.VERSION, name, data, _data.expires);
@@ -129,26 +129,26 @@ const localstorage = function () {
},
// remove a key with a given version.
- remove: function (name) {
+ remove(name) {
ls.removeData(_data.VERSION, name);
},
// Remove keys which match the pattern given by name.
- removeRegex: function (name) {
+ removeRegex(name) {
ls.removeDataRegex(_data.VERSION, name);
},
- migrate: function (name, v1, v2, callback) {
+ migrate(name, v1, v2, callback) {
return ls.migrate(name, v1, v2, callback);
},
};
// set a new master version for the LocalStorage instance.
Object.defineProperty(prototype, "version", {
- get: function () {
+ get() {
return _data.VERSION;
},
- set: function (version) {
+ set(version) {
_data.VERSION = version;
},
});
diff --git a/static/js/markdown.js b/static/js/markdown.js
index 16634fe8e7..7ce1b0930f 100644
--- a/static/js/markdown.js
+++ b/static/js/markdown.js
@@ -89,7 +89,7 @@ exports.apply_markdown = function (message) {
message_store.init_booleans(message);
const options = {
- userMentionHandler: function (mention, silently) {
+ userMentionHandler(mention, silently) {
if (mention === "all" || mention === "everyone" || mention === "stream") {
message.mentioned = true;
return '' + "@" + mention + "";
@@ -160,7 +160,7 @@ exports.apply_markdown = function (message) {
const actual_full_name = helpers.get_actual_name_from_user_id(user_id);
return str + _.escape(actual_full_name) + "";
},
- groupMentionHandler: function (name) {
+ groupMentionHandler(name) {
const group = helpers.get_user_group_from_name(name);
if (group !== undefined) {
if (helpers.is_member_of_user_group(group.id, helpers.my_user_id())) {
@@ -177,7 +177,7 @@ exports.apply_markdown = function (message) {
}
return;
},
- silencedMentionHandler: function (quote) {
+ silencedMentionHandler(quote) {
// Silence quoted mentions.
const user_mention_re = /]*>@/gm;
quote = quote.replace(user_mention_re, (match) => {
@@ -485,7 +485,7 @@ exports.initialize = function (realm_filters, helper_config) {
function disable_markdown_regex(rules, name) {
rules[name] = {
- exec: function () {
+ exec() {
return false;
},
};
diff --git a/static/js/message_edit.js b/static/js/message_edit.js
index dfac99fc07..1d6db55f30 100644
--- a/static/js/message_edit.js
+++ b/static/js/message_edit.js
@@ -291,16 +291,16 @@ function edit_message(row, raw_content) {
render_message_edit_form({
is_stream: message.type === "stream",
message_id: message.id,
- is_editable: is_editable,
+ is_editable,
is_content_editable: editability === exports.editability_types.FULL,
has_been_editable: editability !== editability_types.NO,
topic: message.topic,
content: raw_content,
- file_upload_enabled: file_upload_enabled,
- show_video_chat_button: show_video_chat_button,
+ file_upload_enabled,
+ show_video_chat_button,
minutes_to_edit: Math.floor(page_params.realm_message_content_edit_limit_seconds / 60),
- show_edit_stream: show_edit_stream,
- available_streams: available_streams,
+ show_edit_stream,
+ available_streams,
stream_id: message.stream_id,
stream_name: message.stream,
notify_new_thread: exports.notify_new_thread_default,
@@ -308,7 +308,7 @@ function edit_message(row, raw_content) {
}),
);
- const edit_obj = {form: form, raw_content: raw_content};
+ const edit_obj = {form, raw_content};
currently_editing_messages.set(message.id, edit_obj);
current_msg_list.show_edit_message(row, edit_obj);
@@ -506,7 +506,7 @@ exports.start = function (row, edit_box_open_callback) {
channel.get({
url: "/json/messages/" + message.id,
idempotent: true,
- success: function (data) {
+ success(data) {
if (current_msg_list === msg_list) {
message.raw_content = data.raw_content;
start_edit_with_content(row, message.raw_content, edit_box_open_callback);
@@ -584,7 +584,7 @@ exports.save_inline_topic_edit = function (row) {
if (message.locally_echoed) {
if (topic_changed) {
- echo.edit_locally(message, {new_topic: new_topic});
+ echo.edit_locally(message, {new_topic});
row = current_msg_list.get_row(message_id);
}
exports.end_inline_topic_edit(row);
@@ -600,11 +600,11 @@ exports.save_inline_topic_edit = function (row) {
channel.patch({
url: "/json/messages/" + message.id,
data: request,
- success: function () {
+ success() {
const spinner = row.find(".topic_edit_spinner");
loading.destroy_indicator(spinner);
},
- error: function (xhr) {
+ error(xhr) {
const spinner = row.find(".topic_edit_spinner");
loading.destroy_indicator(spinner);
if (msg_list === current_msg_list) {
@@ -646,8 +646,8 @@ exports.save_message_row_edit = function (row) {
// `edit_locally` handles the case where `new_topic/new_stream_id` is undefined
echo.edit_locally(message, {
raw_content: new_content,
- new_topic: new_topic,
- new_stream_id: new_stream_id,
+ new_topic,
+ new_stream_id,
});
row = current_msg_list.get_row(message_id);
}
@@ -735,13 +735,13 @@ exports.save_message_row_edit = function (row) {
channel.patch({
url: "/json/messages/" + message.id,
data: request,
- success: function () {
+ success() {
if (edit_locally_echoed) {
delete message.local_edit_timestamp;
currently_echoing_messages.delete(message_id);
}
},
- error: function (xhr) {
+ error(xhr) {
if (msg_list === current_msg_list) {
message_id = rows.id(row);
@@ -846,14 +846,14 @@ exports.delete_message = function (msg_id) {
hide_delete_btn_show_spinner(true);
channel.del({
url: "/json/messages/" + msg_id,
- success: function () {
+ success() {
$("#delete_message_modal").modal("hide");
currently_deleting_messages = currently_deleting_messages.filter(
(id) => id !== msg_id,
);
hide_delete_btn_show_spinner(false);
},
- error: function (xhr) {
+ error(xhr) {
currently_deleting_messages = currently_deleting_messages.filter(
(id) => id !== msg_id,
);
@@ -872,9 +872,9 @@ exports.delete_topic = function (stream_id, topic_name) {
channel.post({
url: "/json/streams/" + stream_id + "/delete_topic",
data: {
- topic_name: topic_name,
+ topic_name,
},
- success: function () {
+ success() {
$("#delete_topic_modal").modal("hide");
},
});
@@ -900,21 +900,21 @@ exports.move_topic_containing_message_to_stream = function (
stream_id: new_stream_id,
propagate_mode: "change_all",
topic: new_topic_name,
- send_notification_to_old_thread: send_notification_to_old_thread,
- send_notification_to_new_thread: send_notification_to_new_thread,
+ send_notification_to_old_thread,
+ send_notification_to_new_thread,
};
exports.notify_old_thread_default = send_notification_to_old_thread;
exports.notify_new_thread_default = send_notification_to_new_thread;
channel.patch({
url: "/json/messages/" + message_id,
data: request,
- success: function () {
+ success() {
// The main UI will update via receiving the event
// from server_events.js.
// TODO: This should probably remove a spinner and
// close the modal.
},
- error: function (xhr) {
+ error(xhr) {
ui_report.error(i18n.t("Error moving the topic"), xhr, $("#home-error"), 4000);
},
});
diff --git a/static/js/message_edit_history.js b/static/js/message_edit_history.js
index 89e6af8a17..b160f039e5 100644
--- a/static/js/message_edit_history.js
+++ b/static/js/message_edit_history.js
@@ -4,7 +4,7 @@ exports.fetch_and_render_message_history = function (message) {
channel.get({
url: "/json/messages/" + message.id + "/history",
data: {message_id: JSON.stringify(message.id)},
- success: function (data) {
+ success(data) {
const content_edit_history = [];
let prev_datestamp = null;
@@ -54,7 +54,7 @@ exports.fetch_and_render_message_history = function (message) {
}),
);
},
- error: function (xhr) {
+ error(xhr) {
ui_report.error(
i18n.t("Error fetching message edit history"),
xhr,
diff --git a/static/js/message_events.js b/static/js/message_events.js
index 0e609abc58..df346ce1d5 100644
--- a/static/js/message_events.js
+++ b/static/js/message_events.js
@@ -15,7 +15,7 @@ function maybe_add_narrowed_messages(messages, msg_list) {
narrow: JSON.stringify(narrow_state.public_operators()),
},
timeout: 5000,
- success: function (data) {
+ success(data) {
if (msg_list !== current_msg_list) {
// We unnarrowed in the mean time
return;
@@ -45,7 +45,7 @@ function maybe_add_narrowed_messages(messages, msg_list) {
unread_ops.process_visible();
notifications.notify_messages_outside_current_search(elsewhere_messages);
},
- error: function () {
+ error() {
// We might want to be more clever here
setTimeout(() => {
if (msg_list === current_msg_list) {
@@ -230,7 +230,7 @@ exports.update_messages = function update_messages(events) {
// remove the message from the current/narrowed message list.
const cur_row = current_msg_list.get_row(id);
if (cur_row !== undefined) {
- messages_to_rerender.push({id: id});
+ messages_to_rerender.push({id});
}
}
}
diff --git a/static/js/message_fetch.js b/static/js/message_fetch.js
index 615e8e682d..f94fa7905a 100644
--- a/static/js/message_fetch.js
+++ b/static/js/message_fetch.js
@@ -67,7 +67,7 @@ function get_messages_success(data, opts) {
const update_loading_indicator = opts.msg_list === current_msg_list;
if (opts.num_before > 0) {
opts.msg_list.data.fetch_status.finish_older_batch({
- update_loading_indicator: update_loading_indicator,
+ update_loading_indicator,
found_oldest: data.found_oldest,
history_limited: data.history_limited,
});
@@ -87,7 +87,7 @@ function get_messages_success(data, opts) {
if (opts.num_after > 0) {
opts.fetch_again = opts.msg_list.data.fetch_status.finish_newer_batch(data.messages, {
- update_loading_indicator: update_loading_indicator,
+ update_loading_indicator,
found_newest: data.found_newest,
});
if (opts.msg_list === home_msg_list) {
@@ -188,11 +188,11 @@ exports.load_messages = function (opts) {
let update_loading_indicator = opts.msg_list === current_msg_list;
if (opts.num_before > 0) {
opts.msg_list.data.fetch_status.start_older_batch({
- update_loading_indicator: update_loading_indicator,
+ update_loading_indicator,
});
if (opts.msg_list === home_msg_list) {
message_list.all.data.fetch_status.start_older_batch({
- update_loading_indicator: update_loading_indicator,
+ update_loading_indicator,
});
}
}
@@ -201,11 +201,11 @@ exports.load_messages = function (opts) {
// We hide the bottom loading indicator when we're fetching both top and bottom messages.
update_loading_indicator = update_loading_indicator && opts.num_before === 0;
opts.msg_list.data.fetch_status.start_newer_batch({
- update_loading_indicator: update_loading_indicator,
+ update_loading_indicator,
});
if (opts.msg_list === home_msg_list) {
message_list.all.data.fetch_status.start_newer_batch({
- update_loading_indicator: update_loading_indicator,
+ update_loading_indicator,
});
}
}
@@ -215,12 +215,12 @@ exports.load_messages = function (opts) {
channel.get({
url: "/json/messages",
- data: data,
+ data,
idempotent: true,
- success: function (data) {
+ success(data) {
get_messages_success(data, opts);
},
- error: function (xhr) {
+ error(xhr) {
if (opts.msg_list.narrowed && opts.msg_list !== current_msg_list) {
// We unnarrowed before getting an error so don't
// bother trying again or doing further processing.
@@ -255,7 +255,7 @@ exports.load_messages_for_narrow = function (opts) {
anchor: opts.anchor,
num_before: consts.narrow_before,
num_after: consts.narrow_after,
- msg_list: msg_list,
+ msg_list,
cont: opts.cont,
});
};
@@ -308,7 +308,7 @@ exports.maybe_load_older_messages = function (opts) {
}
exports.do_backfill({
- msg_list: msg_list,
+ msg_list,
num_before: consts.backward_batch_size,
});
};
@@ -318,11 +318,11 @@ exports.do_backfill = function (opts) {
const anchor = exports.get_backfill_anchor(msg_list);
exports.load_messages({
- anchor: anchor,
+ anchor,
num_before: opts.num_before,
num_after: 0,
- msg_list: msg_list,
- cont: function () {
+ msg_list,
+ cont() {
if (opts.cont) {
opts.cont();
}
@@ -351,10 +351,10 @@ exports.maybe_load_newer_messages = function (opts) {
}
exports.load_messages({
- anchor: anchor,
+ anchor,
num_before: 0,
num_after: consts.forward_batch_size,
- msg_list: msg_list,
+ msg_list,
cont: load_more,
});
};
@@ -363,7 +363,7 @@ exports.start_backfilling_messages = function () {
// backfill more messages after the user is idle
$(document).idle({
idle: consts.backfill_idle_time,
- onIdle: function () {
+ onIdle() {
exports.do_backfill({
num_before: consts.backfill_batch_size,
msg_list: home_msg_list,
@@ -419,7 +419,7 @@ exports.initialize = function () {
anchor = "first_unread";
}
exports.load_messages({
- anchor: anchor,
+ anchor,
num_before: consts.num_before_home_anchor,
num_after: consts.num_after_home_anchor,
msg_list: home_msg_list,
diff --git a/static/js/message_flags.js b/static/js/message_flags.js
index bc07e7de44..23e8380804 100644
--- a/static/js/message_flags.js
+++ b/static/js/message_flags.js
@@ -4,8 +4,8 @@ function send_flag_update(message, flag, op) {
idempotent: true,
data: {
messages: JSON.stringify([message.id]),
- flag: flag,
- op: op,
+ flag,
+ op,
},
});
}
diff --git a/static/js/message_list.js b/static/js/message_list.js
index 93d3d03791..0212916d06 100644
--- a/static/js/message_list.js
+++ b/static/js/message_list.js
@@ -15,7 +15,7 @@ exports.MessageList = function (opts) {
this.muting_enabled = opts.muting_enabled;
this.data = new MessageListData({
muting_enabled: this.muting_enabled,
- filter: filter,
+ filter,
});
}
@@ -76,47 +76,47 @@ exports.MessageList.prototype = {
return render_info;
},
- get: function (id) {
+ get(id) {
return this.data.get(id);
},
- num_items: function () {
+ num_items() {
return this.data.num_items();
},
- empty: function () {
+ empty() {
return this.data.empty();
},
- first: function () {
+ first() {
return this.data.first();
},
- last: function () {
+ last() {
return this.data.last();
},
- prev: function () {
+ prev() {
return this.data.prev();
},
- next: function () {
+ next() {
return this.data.next();
},
- is_at_end: function () {
+ is_at_end() {
return this.data.is_at_end();
},
- nth_most_recent_id: function (n) {
+ nth_most_recent_id(n) {
return this.data.nth_most_recent_id(n);
},
- is_search: function () {
+ is_search() {
return this.data.is_search();
},
- can_mark_messages_read: function () {
+ can_mark_messages_read() {
return this.data.can_mark_messages_read();
},
@@ -131,7 +131,7 @@ exports.MessageList.prototype = {
}
},
- selected_id: function () {
+ selected_id() {
return this.data.selected_id();
},
@@ -144,7 +144,7 @@ exports.MessageList.prototype = {
mark_read: true,
force_rerender: false,
...opts,
- id: id,
+ id,
msg_list: this,
previously_selected: this.data.selected_id(),
};
@@ -172,8 +172,8 @@ exports.MessageList.prototype = {
if (!opts.use_closest && closest_id !== id) {
error_data = {
table_name: this.table_name,
- id: id,
- closest_id: closest_id,
+ id,
+ closest_id,
};
blueslip.error("Selected message id not in MessageList", error_data);
}
@@ -181,7 +181,7 @@ exports.MessageList.prototype = {
if (closest_id === -1 && !opts.empty_ok) {
error_data = {
table_name: this.table_name,
- id: id,
+ id,
items_length: this.data.num_items(),
};
blueslip.fatal("Cannot select id -1", error_data);
@@ -212,27 +212,27 @@ exports.MessageList.prototype = {
return this.get_row(this.data.selected_id());
},
- closest_id: function (id) {
+ closest_id(id) {
return this.data.closest_id(id);
},
- advance_past_messages: function (msg_ids) {
+ advance_past_messages(msg_ids) {
return this.data.advance_past_messages(msg_ids);
},
- selected_idx: function () {
+ selected_idx() {
return this.data.selected_idx();
},
- subscribed_bookend_content: function (stream_name) {
+ subscribed_bookend_content(stream_name) {
return i18n.t("You subscribed to stream __stream__", {stream: stream_name});
},
- unsubscribed_bookend_content: function (stream_name) {
+ unsubscribed_bookend_content(stream_name) {
return i18n.t("You unsubscribed from stream __stream__", {stream: stream_name});
},
- not_subscribed_bookend_content: function (stream_name) {
+ not_subscribed_bookend_content(stream_name) {
return i18n.t("You are not subscribed to stream __stream__", {stream: stream_name});
},
@@ -275,7 +275,7 @@ exports.MessageList.prototype = {
}
},
- unmuted_messages: function (messages) {
+ unmuted_messages(messages) {
return this.data.unmuted_messages(messages);
},
@@ -284,7 +284,7 @@ exports.MessageList.prototype = {
this.append_to_view(viewable_messages, opts);
},
- append_to_view: function (messages, opts) {
+ append_to_view(messages, opts) {
opts = {messages_are_new: false, ...opts};
this.num_appends += 1;
@@ -314,7 +314,7 @@ exports.MessageList.prototype = {
row.trigger("mouseleave");
},
- show_edit_topic_on_recipient_row: function (recipient_row, form) {
+ show_edit_topic_on_recipient_row(recipient_row, form) {
recipient_row.find(".topic_edit_form").append(form);
recipient_row.find(".on_hover_topic_edit").hide();
recipient_row.find(".edit_content_button").hide();
@@ -322,7 +322,7 @@ exports.MessageList.prototype = {
recipient_row.find(".topic_edit").show();
},
- hide_edit_topic_on_recipient_row: function (recipient_row) {
+ hide_edit_topic_on_recipient_row(recipient_row) {
recipient_row.find(".stream_topic").show();
recipient_row.find(".on_hover_topic_edit").show();
recipient_row.find(".edit_content_button").show();
@@ -330,7 +330,7 @@ exports.MessageList.prototype = {
recipient_row.find(".topic_edit").hide();
},
- show_message_as_read: function (message, options) {
+ show_message_as_read(message, options) {
const row = this.get_row(message.id);
if (options.from === "pointer" || options.from === "server") {
row.find(".unread_marker").addClass("fast_fade");
@@ -360,7 +360,7 @@ exports.MessageList.prototype = {
this.redo_selection();
},
- redo_selection: function () {
+ redo_selection() {
const selected_id = this.data.selected_id();
if (selected_id !== -1) {
@@ -380,33 +380,33 @@ exports.MessageList.prototype = {
return this.data.all_messages();
},
- first_unread_message_id: function () {
+ first_unread_message_id() {
return this.data.first_unread_message_id();
},
- message_range: function (start, end) {
+ message_range(start, end) {
return this.data.message_range(start, end);
},
- get_row: function (id) {
+ get_row(id) {
return this.view.get_row(id);
},
- update_user_full_name: function (user_id, full_name) {
+ update_user_full_name(user_id, full_name) {
this.data.update_user_full_name(user_id, full_name);
if (this.table_name !== undefined) {
this.view.rerender_preserving_scrolltop();
}
},
- update_user_avatar: function (user_id, avatar_url) {
+ update_user_avatar(user_id, avatar_url) {
this.data.update_user_avatar(user_id, avatar_url);
if (this.table_name !== undefined) {
this.view.rerender_preserving_scrolltop();
}
},
- update_stream_name: function (stream_id, new_stream_name) {
+ update_stream_name(stream_id, new_stream_name) {
this.data.update_stream_name(stream_id, new_stream_name);
if (this.table_name !== undefined) {
this.view.rerender_preserving_scrolltop();
@@ -416,10 +416,10 @@ exports.MessageList.prototype = {
change_message_id: function MessageList_change_message_id(old_id, new_id) {
const self = this;
const opts = {
- is_current_list: function () {
+ is_current_list() {
return current_msg_list === self;
},
- re_render: function () {
+ re_render() {
self.view.rerender_preserving_scrolltop();
self.redo_selection();
},
@@ -427,7 +427,7 @@ exports.MessageList.prototype = {
this.data.change_message_id(old_id, new_id, opts);
},
- get_last_message_sent_by_me: function () {
+ get_last_message_sent_by_me() {
return this.data.get_last_message_sent_by_me();
},
};
diff --git a/static/js/message_list_data.js b/static/js/message_list_data.js
index 00b08eeab7..7d12705cee 100644
--- a/static/js/message_list_data.js
+++ b/static/js/message_list_data.js
@@ -19,27 +19,27 @@ function MessageListData(opts) {
}
MessageListData.prototype = {
- all_messages: function () {
+ all_messages() {
return this._items;
},
- num_items: function () {
+ num_items() {
return this._items.length;
},
- empty: function () {
+ empty() {
return this._items.length === 0;
},
- first: function () {
+ first() {
return this._items[0];
},
- last: function () {
+ last() {
return this._items[this._items.length - 1];
},
- select_idx: function () {
+ select_idx() {
if (this._selected_id === -1) {
return;
}
@@ -52,7 +52,7 @@ MessageListData.prototype = {
return i;
},
- prev: function () {
+ prev() {
const i = this.select_idx();
if (i === undefined) {
@@ -66,7 +66,7 @@ MessageListData.prototype = {
return this._items[i - 1].id;
},
- next: function () {
+ next() {
const i = this.select_idx();
if (i === undefined) {
@@ -80,7 +80,7 @@ MessageListData.prototype = {
return this._items[i + 1].id;
},
- is_at_end: function () {
+ is_at_end() {
if (this._selected_id === -1) {
return false;
}
@@ -96,7 +96,7 @@ MessageListData.prototype = {
return last_msg.id === this._selected_id;
},
- nth_most_recent_id: function (n) {
+ nth_most_recent_id(n) {
const i = this._items.length - n;
if (i < 0) {
return -1;
@@ -104,7 +104,7 @@ MessageListData.prototype = {
return this._items[i].id;
},
- clear: function () {
+ clear() {
if (this.muting_enabled) {
this._all_items = [];
}
@@ -113,7 +113,7 @@ MessageListData.prototype = {
this._hash.clear();
},
- get: function (id) {
+ get(id) {
id = parseFloat(id);
if (isNaN(id)) {
return;
@@ -121,33 +121,33 @@ MessageListData.prototype = {
return this._hash.get(id);
},
- clear_selected_id: function () {
+ clear_selected_id() {
this._selected_id = -1;
},
- selected_id: function () {
+ selected_id() {
return this._selected_id;
},
- set_selected_id: function (id) {
+ set_selected_id(id) {
this._selected_id = id;
},
- selected_idx: function () {
+ selected_idx() {
return this._lower_bound(this._selected_id);
},
- reset_select_to_closest: function () {
+ reset_select_to_closest() {
this._selected_id = this.closest_id(this._selected_id);
},
- is_search: function () {
+ is_search() {
return this.filter.is_search();
},
- can_mark_messages_read: function () {
+ can_mark_messages_read() {
return this.filter.can_mark_messages_read();
},
- _get_predicate: function () {
+ _get_predicate() {
// We cache this.
if (!this.predicate) {
this.predicate = this.filter.predicate();
@@ -155,32 +155,32 @@ MessageListData.prototype = {
return this.predicate;
},
- valid_non_duplicated_messages: function (messages) {
+ valid_non_duplicated_messages(messages) {
const predicate = this._get_predicate();
const self = this;
return messages.filter((msg) => self.get(msg.id) === undefined && predicate(msg));
},
- filter_incoming: function (messages) {
+ filter_incoming(messages) {
const predicate = this._get_predicate();
return messages.filter(predicate);
},
- unmuted_messages: function (messages) {
+ unmuted_messages(messages) {
return messages.filter(
(message) =>
!muting.is_topic_muted(message.stream_id, message.topic) || message.mentioned,
);
},
- update_items_for_muting: function () {
+ update_items_for_muting() {
if (!this.muting_enabled) {
return;
}
this._items = this.unmuted_messages(this._all_items);
},
- first_unread_message_id: function () {
+ first_unread_message_id() {
const first_unread = this._items.find((message) => unread.message_unread(message));
if (first_unread) {
@@ -191,7 +191,7 @@ MessageListData.prototype = {
return this.last().id;
},
- update_user_full_name: function (user_id, full_name) {
+ update_user_full_name(user_id, full_name) {
for (const item of this._items) {
if (item.sender_id && item.sender_id === user_id) {
item.sender_full_name = full_name;
@@ -199,7 +199,7 @@ MessageListData.prototype = {
}
},
- update_user_avatar: function (user_id, avatar_url) {
+ update_user_avatar(user_id, avatar_url) {
// TODO:
// We may want to de-dup some logic with update_user_full_name,
// especially if we want to optimize this with some kind of
@@ -211,7 +211,7 @@ MessageListData.prototype = {
}
},
- update_stream_name: function (stream_id, new_stream_name) {
+ update_stream_name(stream_id, new_stream_name) {
for (const item of this._items) {
if (item.stream_id && item.stream_id === stream_id) {
item.display_recipient = new_stream_name;
@@ -220,7 +220,7 @@ MessageListData.prototype = {
}
},
- add_messages: function (messages) {
+ add_messages(messages) {
const self = this;
let top_messages = [];
let bottom_messages = [];
@@ -265,15 +265,15 @@ MessageListData.prototype = {
}
const info = {
- top_messages: top_messages,
- bottom_messages: bottom_messages,
- interior_messages: interior_messages,
+ top_messages,
+ bottom_messages,
+ interior_messages,
};
return info;
},
- add_anywhere: function (messages) {
+ add_anywhere(messages) {
// Caller should have already filtered messages.
// This should be used internally when we have
// "interior" messages to add and can't optimize
@@ -295,7 +295,7 @@ MessageListData.prototype = {
return viewable_messages;
},
- append: function (messages) {
+ append(messages) {
// Caller should have already filtered
let viewable_messages;
if (this.muting_enabled) {
@@ -309,7 +309,7 @@ MessageListData.prototype = {
return viewable_messages;
},
- prepend: function (messages) {
+ prepend(messages) {
// Caller should have already filtered
let viewable_messages;
if (this.muting_enabled) {
@@ -323,7 +323,7 @@ MessageListData.prototype = {
return viewable_messages;
},
- remove: function (messages) {
+ remove(messages) {
const self = this;
for (const message of messages) {
@@ -349,7 +349,7 @@ MessageListData.prototype = {
},
// Returns messages from the given message list in the specified range, inclusive
- message_range: function (start, end) {
+ message_range(start, end) {
if (start === -1) {
blueslip.error("message_range given a start of -1");
}
@@ -363,7 +363,7 @@ MessageListData.prototype = {
// into the message list, without disrupting the sort order
// This takes into account the potentially-unsorted
// nature of local message IDs in the message list
- _lower_bound: function (id) {
+ _lower_bound(id) {
const self = this;
function less_func(msg, ref_id, a_idx) {
if (self._is_localonly_id(msg.id)) {
@@ -382,7 +382,7 @@ MessageListData.prototype = {
return util.lower_bound(self._items, id, less_func);
},
- closest_id: function (id) {
+ closest_id(id) {
// We directly keep track of local-only messages,
// so if we're asked for one that we know we have,
// just return it directly
@@ -443,7 +443,7 @@ MessageListData.prototype = {
return items[closest].id;
},
- advance_past_messages: function (msg_ids) {
+ advance_past_messages(msg_ids) {
// Start with the current pointer, but then keep advancing the
// pointer while the next message's id is in msg_ids. See trac #1555
// for more context, but basically we are skipping over contiguous
@@ -467,7 +467,7 @@ MessageListData.prototype = {
}
},
- _add_to_hash: function (messages) {
+ _add_to_hash(messages) {
const self = this;
messages.forEach((elem) => {
const id = parseFloat(elem.id);
@@ -485,11 +485,11 @@ MessageListData.prototype = {
});
},
- _is_localonly_id: function (id) {
+ _is_localonly_id(id) {
return id % 1 !== 0;
},
- _next_nonlocal_message: function (item_list, start_index, op) {
+ _next_nonlocal_message(item_list, start_index, op) {
let cur_idx = start_index;
do {
cur_idx = op(cur_idx);
@@ -497,7 +497,7 @@ MessageListData.prototype = {
return item_list[cur_idx];
},
- change_message_id: function (old_id, new_id, opts) {
+ change_message_id(old_id, new_id, opts) {
// Update our local cache that uses the old id to the new id
if (this._hash.has(old_id)) {
const msg = this._hash.get(old_id);
@@ -521,7 +521,7 @@ MessageListData.prototype = {
this.reorder_messages(new_id, opts);
},
- reorder_messages: function (new_id, opts) {
+ reorder_messages(new_id, opts) {
function message_sort_func(a, b) {
return a.id - b.id;
}
@@ -561,7 +561,7 @@ MessageListData.prototype = {
}
},
- get_last_message_sent_by_me: function () {
+ get_last_message_sent_by_me() {
const msg_index = _.findLastIndex(this._items, {sender_id: page_params.user_id});
if (msg_index === -1) {
return;
diff --git a/static/js/message_list_view.js b/static/js/message_list_view.js
index ef5e558fbd..d0fa045f93 100644
--- a/static/js/message_list_view.js
+++ b/static/js/message_list_view.js
@@ -167,7 +167,7 @@ MessageListView.prototype = {
// trigger a re-render
_RENDER_THRESHOLD: 50,
- _get_msg_timestring: function (message_container) {
+ _get_msg_timestring(message_container) {
let last_edit_timestamp;
if (message_container.msg.local_edit_timestamp !== undefined) {
last_edit_timestamp = message_container.msg.local_edit_timestamp;
@@ -185,7 +185,7 @@ MessageListView.prototype = {
}
},
- _add_msg_edited_vars: function (message_container) {
+ _add_msg_edited_vars(message_container) {
// This adds variables to message_container object which calculate bools for
// checking position of "(EDITED)" label as well as the edited timestring
// The bools can be defined only when the message is edited
@@ -209,7 +209,7 @@ MessageListView.prototype = {
}
},
- add_subscription_marker: function (group, last_msg_container, first_msg_container) {
+ add_subscription_marker(group, last_msg_container, first_msg_container) {
if (last_msg_container === undefined) {
return;
}
@@ -233,7 +233,7 @@ MessageListView.prototype = {
}
},
- build_message_groups: function (message_containers) {
+ build_message_groups(message_containers) {
function start_group() {
return {
message_containers: [],
@@ -350,7 +350,7 @@ MessageListView.prototype = {
return new_message_groups;
},
- join_message_groups: function (first_group, second_group) {
+ join_message_groups(first_group, second_group) {
// join_message_groups will combine groups if they have the
// same_recipient and the view supports collapsing, otherwise
// it may add a subscription_marker if required. It returns
@@ -394,7 +394,7 @@ MessageListView.prototype = {
return false;
},
- merge_message_groups: function (new_message_groups, where) {
+ merge_message_groups(new_message_groups, where) {
// merge_message_groups takes a list of new messages groups to add to
// this._message_groups and a location where to merge them currently
// top or bottom. It returns an object of changes which needed to be
@@ -438,8 +438,8 @@ MessageListView.prototype = {
const was_joined = this.join_message_groups(first_group, second_group);
if (was_joined) {
update_message_date_divider({
- prev_msg_container: prev_msg_container,
- curr_msg_container: curr_msg_container,
+ prev_msg_container,
+ curr_msg_container,
});
} else {
clear_message_date_divider(curr_msg_container);
@@ -491,14 +491,14 @@ MessageListView.prototype = {
return message_actions;
},
- _put_row: function (row) {
+ _put_row(row) {
// row is a jQuery object wrapping one message row
if (row.hasClass("message_row")) {
this._rows.set(rows.id(row), row);
}
},
- _post_process: function ($message_rows) {
+ _post_process($message_rows) {
// $message_rows wraps one or more message rows
if ($message_rows.constructor !== jQuery) {
@@ -515,7 +515,7 @@ MessageListView.prototype = {
}
},
- _post_process_single_row: function (row) {
+ _post_process_single_row(row) {
// For message formatting that requires some post-processing
// (and is not possible to handle solely via CSS), this is
// where we modify the content. It is a goal to minimize how
@@ -535,12 +535,12 @@ MessageListView.prototype = {
message_edit.maybe_show_edit(row, id);
submessage.process_submessages({
- row: row,
+ row,
message_id: id,
});
},
- _get_message_template: function (message_container) {
+ _get_message_template(message_container) {
const msg_reactions = reactions.get_message_reactions(message_container.msg);
message_container.msg.message_reactions = msg_reactions;
const msg_to_render = {
@@ -550,21 +550,21 @@ MessageListView.prototype = {
return render_single_message(msg_to_render);
},
- _render_group: function (opts) {
+ _render_group(opts) {
const message_groups = opts.message_groups;
const use_match_properties = opts.use_match_properties;
const table_name = opts.table_name;
return $(
render_message_group({
- message_groups: message_groups,
- use_match_properties: use_match_properties,
- table_name: table_name,
+ message_groups,
+ use_match_properties,
+ table_name,
}),
);
},
- render: function (messages, where, messages_are_new) {
+ render(messages, where, messages_are_new) {
// This function processes messages into chunks with separators between them,
// and templates them to be inserted as table rows into the DOM.
@@ -825,7 +825,7 @@ MessageListView.prototype = {
}
},
- _new_messages_height: function (rendered_elems) {
+ _new_messages_height(rendered_elems) {
let new_messages_height = 0;
for (const elem of rendered_elems.reverse()) {
@@ -839,7 +839,7 @@ MessageListView.prototype = {
return new_messages_height;
},
- _scroll_limit: function (selected_row, viewport_info) {
+ _scroll_limit(selected_row, viewport_info) {
// This scroll limit is driven by the TOP of the feed, and
// it's the max amount that we can scroll down (or "skooch
// up" the messages) before knocking the selected message
@@ -857,7 +857,7 @@ MessageListView.prototype = {
return scroll_limit;
},
- _maybe_autoscroll: function (new_messages_height) {
+ _maybe_autoscroll(new_messages_height) {
// If we are near the bottom of our feed (the bottom is visible) and can
// scroll up without moving the pointer out of the viewport, do so, by
// up to the amount taken up by the new message.
@@ -951,7 +951,7 @@ MessageListView.prototype = {
return need_user_to_scroll;
},
- clear_rendering_state: function (clear_table) {
+ clear_rendering_state(clear_table) {
if (clear_table) {
this.clear_table();
}
@@ -961,7 +961,7 @@ MessageListView.prototype = {
this._render_win_end = 0;
},
- update_render_window: function (selected_idx, check_for_changed) {
+ update_render_window(selected_idx, check_for_changed) {
const new_start = Math.max(selected_idx - this._RENDER_WINDOW_SIZE / 2, 0);
if (check_for_changed && new_start === this._render_win_start) {
return false;
@@ -975,7 +975,7 @@ MessageListView.prototype = {
return true;
},
- maybe_rerender: function () {
+ maybe_rerender() {
if (this.table_name === undefined) {
return false;
}
@@ -1010,7 +1010,7 @@ MessageListView.prototype = {
return true;
},
- rerender_preserving_scrolltop: function (discard_rendering_state) {
+ rerender_preserving_scrolltop(discard_rendering_state) {
// old_offset is the number of pixels between the top of the
// viewable window and the selected message
let old_offset;
@@ -1029,12 +1029,12 @@ MessageListView.prototype = {
return this.rerender_with_target_scrolltop(selected_row, old_offset);
},
- set_message_offset: function (offset) {
+ set_message_offset(offset) {
const msg = this.selected_row();
message_viewport.scrollTop(message_viewport.scrollTop() + msg.offset().top - offset);
},
- rerender_with_target_scrolltop: function (selected_row, target_offset) {
+ rerender_with_target_scrolltop(selected_row, target_offset) {
// target_offset is the target number of pixels between the top of the
// viewable window and the selected message
this.clear_table();
@@ -1056,7 +1056,7 @@ MessageListView.prototype = {
}
},
- _find_message_group: function (message_group_id) {
+ _find_message_group(message_group_id) {
// Ideally, we'd maintain this data structure with a hash
// table or at least a pointer from the message containers (in
// either case, updating the data structure when message
@@ -1071,7 +1071,7 @@ MessageListView.prototype = {
);
},
- _rerender_header: function (message_containers) {
+ _rerender_header(message_containers) {
// Given a list of messages that are in the **same** message group,
// rerender the header / recipient bar of the messages
if (message_containers.length === 0) {
@@ -1111,7 +1111,7 @@ MessageListView.prototype = {
header.replaceWith(rendered_recipient_row);
},
- _rerender_message: function (message_container, message_content_edited) {
+ _rerender_message(message_container, message_content_edited) {
const row = this.get_row(message_container.msg.id);
const was_selected = this.list.selected_message() === message_container.msg;
@@ -1134,7 +1134,7 @@ MessageListView.prototype = {
}
},
- rerender_messages: function (messages, message_content_edited) {
+ rerender_messages(messages, message_content_edited) {
const self = this;
// Convert messages to list messages
@@ -1169,7 +1169,7 @@ MessageListView.prototype = {
}
},
- append: function (messages, messages_are_new) {
+ append(messages, messages_are_new) {
const cur_window_size = this._render_win_end - this._render_win_start;
let render_info;
@@ -1193,7 +1193,7 @@ MessageListView.prototype = {
return render_info;
},
- prepend: function (messages) {
+ prepend(messages) {
this._render_win_start += messages.length;
this._render_win_end += messages.length;
@@ -1209,7 +1209,7 @@ MessageListView.prototype = {
this.maybe_rerender();
},
- clear_table: function () {
+ clear_table() {
// We do not want to call .empty() because that also clears
// jQuery data. This does mean, however, that we need to be
// mindful of memory leaks.
@@ -1219,7 +1219,7 @@ MessageListView.prototype = {
this.message_containers.clear();
},
- get_row: function (id) {
+ get_row(id) {
const row = this._rows.get(id);
if (row === undefined) {
@@ -1231,31 +1231,31 @@ MessageListView.prototype = {
return row;
},
- clear_trailing_bookend: function () {
+ clear_trailing_bookend() {
const trailing_bookend = rows.get_table(this.table_name).find(".trailing_bookend");
trailing_bookend.remove();
},
- render_trailing_bookend: function (trailing_bookend_content, subscribed, show_button) {
+ render_trailing_bookend(trailing_bookend_content, subscribed, show_button) {
const rendered_trailing_bookend = $(
render_bookend({
bookend_content: trailing_bookend_content,
trailing: show_button,
- subscribed: subscribed,
+ subscribed,
}),
);
rows.get_table(this.table_name).append(rendered_trailing_bookend);
},
- selected_row: function () {
+ selected_row() {
return this.get_row(this.list.selected_id());
},
- get_message: function (id) {
+ get_message(id) {
return this.list.get(id);
},
- change_message_id: function (old_id, new_id) {
+ change_message_id(old_id, new_id) {
if (this._rows.has(old_id)) {
const row = this._rows.get(old_id);
this._rows.delete(old_id);
@@ -1273,7 +1273,7 @@ MessageListView.prototype = {
}
},
- _maybe_format_me_message: function (message_container) {
+ _maybe_format_me_message(message_container) {
if (message_container.msg.is_me_message) {
// Slice the '/me ' off the front, and '
' off the first line
// 'p' tag is sliced off to get sender in the same line as the
diff --git a/static/js/message_viewport.js b/static/js/message_viewport.js
index 2961a649ac..87aaad93c9 100644
--- a/static/js/message_viewport.js
+++ b/static/js/message_viewport.js
@@ -150,13 +150,13 @@ function add_to_visible(
}
const top_of_feed = new util.CachedValue({
- compute_value: function () {
+ compute_value() {
return $(".floating_recipient").offset().top + $(".floating_recipient").safeOuterHeight();
},
});
const bottom_of_feed = new util.CachedValue({
- compute_value: function () {
+ compute_value() {
return $("#compose")[0].getBoundingClientRect().top;
},
});
@@ -277,7 +277,7 @@ exports.scrollTop = function viewport_scrollTop(target_scrollTop) {
function make_dimen_wrapper(dimen_name, dimen_func) {
dimensions[dimen_name] = new util.CachedValue({
- compute_value: function () {
+ compute_value() {
return dimen_func.call(exports.message_pane);
},
});
@@ -313,7 +313,7 @@ exports.system_initiated_animate_scroll = function (scroll_amount) {
in_stoppable_autoscroll = true;
exports.message_pane.animate({
scrollTop: viewport_offset + scroll_amount,
- always: function () {
+ always() {
in_stoppable_autoscroll = false;
},
});
diff --git a/static/js/muting.js b/static/js/muting.js
index cf5342bd5c..70634b0a13 100644
--- a/static/js/muting.js
+++ b/static/js/muting.js
@@ -38,11 +38,11 @@ exports.get_muted_topics = function () {
const date_muted = sub_dict.get(topic);
const date_muted_str = timerender.render_now(new XDate(date_muted)).time_str;
topics.push({
- stream_id: stream_id,
- stream: stream,
- topic: topic,
- date_muted: date_muted,
- date_muted_str: date_muted_str,
+ stream_id,
+ stream,
+ topic,
+ date_muted,
+ date_muted_str,
});
}
}
diff --git a/static/js/muting_ui.js b/static/js/muting_ui.js
index facd75b0a7..5deb4cf775 100644
--- a/static/js/muting_ui.js
+++ b/static/js/muting_ui.js
@@ -27,7 +27,7 @@ exports.rerender = function () {
exports.persist_mute = function (stream_id, topic_name) {
const data = {
- stream_id: stream_id,
+ stream_id,
topic: topic_name,
op: "add",
};
@@ -35,13 +35,13 @@ exports.persist_mute = function (stream_id, topic_name) {
channel.patch({
url: "/json/users/me/subscriptions/muted_topics",
idempotent: true,
- data: data,
+ data,
});
};
exports.persist_unmute = function (stream_id, topic_name) {
const data = {
- stream_id: stream_id,
+ stream_id,
topic: topic_name,
op: "remove",
};
@@ -49,7 +49,7 @@ exports.persist_unmute = function (stream_id, topic_name) {
channel.patch({
url: "/json/users/me/subscriptions/muted_topics",
idempotent: true,
- data: data,
+ data,
});
};
@@ -77,15 +77,15 @@ exports.set_up_muted_topics_ui = function () {
list_render.create(muted_topics_table, muted_topics, {
name: "muted-topics-list",
- modifier: function (muted_topics) {
- return render_muted_topic_ui_row({muted_topics: muted_topics});
+ modifier(muted_topics) {
+ return render_muted_topic_ui_row({muted_topics});
},
filter: {
element: $search_input,
- predicate: function (item, value) {
+ predicate(item, value) {
return item.topic.toLocaleLowerCase().indexOf(value) >= 0;
},
- onupdate: function () {
+ onupdate() {
ui.reset_scrollbar(muted_topics_table.closest(".progressive-table-wrapper"));
},
},
@@ -103,13 +103,13 @@ exports.mute = function (stream_id, topic) {
exports.rerender();
exports.persist_mute(stream_id, topic);
feedback_widget.show({
- populate: function (container) {
+ populate(container) {
const rendered_html = render_topic_muted();
container.html(rendered_html);
container.find(".stream").text(stream_name);
container.find(".topic").text(topic);
},
- on_undo: function () {
+ on_undo() {
exports.unmute(stream_id, topic);
},
title_text: i18n.t("Topic muted"),
diff --git a/static/js/narrow.js b/static/js/narrow.js
index 33bbb3a74c..f19c7f1a37 100644
--- a/static/js/narrow.js
+++ b/static/js/narrow.js
@@ -220,7 +220,7 @@ exports.activate = function (raw_operators, opts) {
let msg_data = new MessageListData({
filter: narrow_state.filter(),
- muting_enabled: muting_enabled,
+ muting_enabled,
});
// Populate the message list if we can apply our filter locally (i.e.
@@ -228,8 +228,8 @@ exports.activate = function (raw_operators, opts) {
// Also update id_info accordingly.
// original back.
exports.maybe_add_local_messages({
- id_info: id_info,
- msg_data: msg_data,
+ id_info,
+ msg_data,
});
if (!id_info.local_select_id) {
@@ -241,7 +241,7 @@ exports.activate = function (raw_operators, opts) {
// the block we're about to request from the server instead.
msg_data = new MessageListData({
filter: narrow_state.filter(),
- muting_enabled: muting_enabled,
+ muting_enabled,
});
}
@@ -292,11 +292,11 @@ exports.activate = function (raw_operators, opts) {
}
message_fetch.load_messages_for_narrow({
- anchor: anchor,
- cont: function () {
+ anchor,
+ cont() {
if (!select_immediately) {
exports.update_selection({
- id_info: id_info,
+ id_info,
select_offset: then_select_offset,
});
}
@@ -308,7 +308,7 @@ exports.activate = function (raw_operators, opts) {
if (select_immediately) {
exports.update_selection({
- id_info: id_info,
+ id_info,
select_offset: then_select_offset,
});
}
@@ -551,7 +551,7 @@ exports.update_selection = function (opts) {
const then_scroll = !preserve_pre_narrowing_screen_position;
message_list.narrowed.select_id(msg_id, {
- then_scroll: then_scroll,
+ then_scroll,
use_closest: true,
force_rerender: true,
});
@@ -649,7 +649,7 @@ exports.narrow_to_next_pm_string = function () {
// Activate narrowing with a single operator.
// This is just for syntactic convenience.
exports.by = function (operator, operand, opts) {
- exports.activate([{operator: operator, operand: operand}], opts);
+ exports.activate([{operator, operand}], opts);
};
exports.by_topic = function (target_id, opts) {
diff --git a/static/js/notifications.js b/static/js/notifications.js
index 1dc02cf8b9..2e822812e8 100644
--- a/static/js/notifications.js
+++ b/static/js/notifications.js
@@ -214,8 +214,8 @@ function in_browser_notify(message, title, content, raw_operators, opts) {
const notification_html = $(
render_notification({
gravatar_url: people.small_avatar_url(message),
- title: title,
- content: content,
+ title,
+ content,
message_id: message.id,
}),
);
@@ -235,7 +235,7 @@ function in_browser_notify(message, title, content, raw_operators, opts) {
$(".notification[data-message-id='" + message.id + "']")
.expectOne()
.data("narrow", {
- raw_operators: raw_operators,
+ raw_operators,
opts_notif: opts,
});
}
@@ -243,10 +243,10 @@ function in_browser_notify(message, title, content, raw_operators, opts) {
exports.notify_above_composebox = function (note, link_class, link_msg_id, link_text) {
const notification_html = $(
render_compose_notification({
- note: note,
- link_class: link_class,
- link_msg_id: link_msg_id,
- link_text: link_text,
+ note,
+ link_class,
+ link_msg_id,
+ link_text,
}),
);
exports.clear_compose_notifications();
@@ -281,17 +281,17 @@ if (window.electron_bridge !== undefined) {
function error(error) {
window.electron_bridge.send_event("send_notification_reply_message_failed", {
- data: data,
- message_id: message_id,
- error: error,
+ data,
+ message_id,
+ error,
});
}
channel.post({
url: "/json/messages",
- data: data,
- success: success,
- error: error,
+ data,
+ success,
+ error,
});
});
}
@@ -397,7 +397,7 @@ function process_notification(notification) {
});
notice_memory.set(key, {
obj: notification_object,
- msg_count: msg_count,
+ msg_count,
message_id: message.id,
});
@@ -579,7 +579,7 @@ exports.received_messages = function (messages) {
if (exports.should_send_desktop_notification(message)) {
process_notification({
- message: message,
+ message,
desktop_notify: exports.granted_desktop_notifications_permission(),
});
}
diff --git a/static/js/overlays.js b/static/js/overlays.js
index bb6b2dfb16..f23acad583 100644
--- a/static/js/overlays.js
+++ b/static/js/overlays.js
@@ -219,7 +219,7 @@ exports.open_settings = function () {
exports.open_overlay({
name: "settings",
overlay: $("#settings_overlay_container"),
- on_close: function () {
+ on_close() {
hashchange.exit_overlay();
},
});
diff --git a/static/js/people.js b/static/js/people.js
index 5014384c5b..68796be2a8 100644
--- a/static/js/people.js
+++ b/static/js/people.js
@@ -1168,7 +1168,7 @@ exports.extract_people_from_message = function (message) {
exports._add_user({
email: person.email,
- user_id: user_id,
+ user_id,
full_name: person.full_name,
is_admin: person.is_realm_admin || false,
is_bot: person.is_bot || false,
diff --git a/static/js/pm_conversations.js b/static/js/pm_conversations.js
index ec831fe442..9170af168b 100644
--- a/static/js/pm_conversations.js
+++ b/static/js/pm_conversations.js
@@ -31,7 +31,7 @@ exports.recent = (function () {
if (conversation === undefined) {
// This is a new user, so create a new object.
conversation = {
- user_ids_string: user_ids_string,
+ user_ids_string,
max_message_id: message_id,
};
recent_message_ids.set(user_ids_string, conversation);
diff --git a/static/js/pm_list.js b/static/js/pm_list.js
index 2f3cd96051..1ede45fcef 100644
--- a/static/js/pm_list.js
+++ b/static/js/pm_list.js
@@ -85,14 +85,14 @@ exports._get_convos = function () {
const display_message = {
recipients: recipients_string,
- user_ids_string: user_ids_string,
+ user_ids_string,
unread: num_unread,
is_zero: num_unread === 0,
- is_active: is_active,
+ is_active,
url: hash_util.pm_with_uri(reply_to),
- user_circle_class: user_circle_class,
- fraction_present: fraction_present,
- is_group: is_group,
+ user_circle_class,
+ fraction_present,
+ is_group,
};
display_messages.push(display_message);
}
diff --git a/static/js/pm_list_dom.js b/static/js/pm_list_dom.js
index 918007922c..ca3d5184f5 100644
--- a/static/js/pm_list_dom.js
+++ b/static/js/pm_list_dom.js
@@ -8,10 +8,10 @@ exports.keyed_pm_li = (convo) => {
const key = convo.user_ids_string;
return {
- key: key,
- render: render,
- convo: convo,
- eq: eq,
+ key,
+ render,
+ convo,
+ eq,
};
};
@@ -21,7 +21,7 @@ exports.pm_ul = (convos) => {
["data-name", "private"],
];
return vdom.ul({
- attrs: attrs,
+ attrs,
keyed_nodes: convos.map(exports.keyed_pm_li),
});
};
diff --git a/static/js/poll_widget.js b/static/js/poll_widget.js
index 0d1df62342..6924ac5c25 100644
--- a/static/js/poll_widget.js
+++ b/static/js/poll_widget.js
@@ -51,13 +51,13 @@ exports.poll_data_holder = function (is_my_poll, question, options) {
option: obj.option,
names: people.safe_full_names(voters),
count: voters.length,
- key: key,
- current_user_vote: current_user_vote,
+ key,
+ current_user_vote,
});
}
const widget_data = {
- options: options,
+ options,
question: poll_question,
};
@@ -66,11 +66,11 @@ exports.poll_data_holder = function (is_my_poll, question, options) {
self.handle = {
new_option: {
- outbound: function (option) {
+ outbound(option) {
const event = {
type: "new_option",
idx: my_idx,
- option: option,
+ option,
};
my_idx += 1;
@@ -78,16 +78,16 @@ exports.poll_data_holder = function (is_my_poll, question, options) {
return event;
},
- inbound: function (sender_id, data) {
+ inbound(sender_id, data) {
const idx = data.idx;
const key = sender_id + "," + idx;
const option = data.option;
const votes = new Map();
key_to_option.set(key, {
- option: option,
+ option,
user_id: sender_id,
- votes: votes,
+ votes,
});
if (my_idx <= idx) {
@@ -97,10 +97,10 @@ exports.poll_data_holder = function (is_my_poll, question, options) {
},
question: {
- outbound: function (question) {
+ outbound(question) {
const event = {
type: "question",
- question: question,
+ question,
};
if (is_my_poll) {
return event;
@@ -108,13 +108,13 @@ exports.poll_data_holder = function (is_my_poll, question, options) {
return;
},
- inbound: function (sender_id, data) {
+ inbound(sender_id, data) {
self.set_question(data.question);
},
},
vote: {
- outbound: function (key) {
+ outbound(key) {
let vote = 1;
// toggle
@@ -124,14 +124,14 @@ exports.poll_data_holder = function (is_my_poll, question, options) {
const event = {
type: "vote",
- key: key,
- vote: vote,
+ key,
+ vote,
};
return event;
},
- inbound: function (sender_id, data) {
+ inbound(sender_id, data) {
const key = data.key;
const vote = data.vote;
const option = key_to_option.get(key);
@@ -168,7 +168,7 @@ exports.poll_data_holder = function (is_my_poll, question, options) {
for (const [i, option] of options.entries()) {
self.handle.new_option.inbound("canned", {
idx: i,
- option: option,
+ option,
});
}
diff --git a/static/js/popovers.js b/static/js/popovers.js
index 0c85df8b13..f8cdae33e3 100644
--- a/static/js/popovers.js
+++ b/static/js/popovers.js
@@ -180,12 +180,12 @@ function render_user_info_popover(
}
const args = {
- can_revoke_away: can_revoke_away,
- can_set_away: can_set_away,
+ can_revoke_away,
+ can_set_away,
is_active: people.is_active_user_for_popover(user.user_id),
is_bot: user.is_bot,
- is_me: is_me,
- is_sender_popover: is_sender_popover,
+ is_me,
+ is_sender_popover,
pm_with_uri: hash_util.pm_with_uri(user.email),
user_circle_class: buddy_data.get_user_circle_class(user.user_id),
private_message_class: private_msg_class,
@@ -320,7 +320,7 @@ exports.show_user_profile = function (user) {
const args = {
full_name: user.full_name,
email: people.get_visible_email(user),
- profile_data: profile_data,
+ profile_data,
user_avatar: "avatar/" + user.email + "/medium",
is_me: people.is_current_user(user.email),
date_joined: moment(user.date_joined).format(dateFormat),
@@ -478,21 +478,21 @@ exports.toggle_actions_popover = function (element, id) {
message_id: message.id,
historical: message.historical,
stream_id: message.stream_id,
- topic: topic,
- use_edit_icon: use_edit_icon,
- editability_menu_item: editability_menu_item,
- can_mute_topic: can_mute_topic,
- can_unmute_topic: can_unmute_topic,
- should_display_collapse: should_display_collapse,
- should_display_uncollapse: should_display_uncollapse,
+ topic,
+ use_edit_icon,
+ editability_menu_item,
+ can_mute_topic,
+ can_unmute_topic,
+ should_display_collapse,
+ should_display_uncollapse,
should_display_add_reaction_option: message.sent_by_me,
- should_display_edit_history_option: should_display_edit_history_option,
- conversation_time_uri: conversation_time_uri,
+ should_display_edit_history_option,
+ conversation_time_uri,
narrowed: narrow_state.active(),
- should_display_delete_option: should_display_delete_option,
+ should_display_delete_option,
should_display_reminder_option: feature_flags.reminders_in_message_action_menu,
- should_display_edit_and_view_source: should_display_edit_and_view_source,
- should_display_quote_and_reply: should_display_quote_and_reply,
+ should_display_edit_and_view_source,
+ should_display_quote_and_reply,
};
const ypos = elt.offset().top;
@@ -517,7 +517,7 @@ exports.render_actions_remind_popover = function (element, id) {
if (elt.data("popover") === undefined) {
const message = current_msg_list.get(id);
const args = {
- message: message,
+ message,
};
const ypos = elt.offset().top;
elt.popover({
@@ -828,7 +828,7 @@ exports.register_click_handlers = function () {
user_status.server_update({
user_id: me,
status_text: "",
- success: function () {
+ success() {
$(".info_popover_actions #status_message").html("");
},
});
diff --git a/static/js/portico/email_log.js b/static/js/portico/email_log.js
index 5899e85297..848111caba 100644
--- a/static/js/portico/email_log.js
+++ b/static/js/portico/email_log.js
@@ -33,8 +33,8 @@ $(() => {
channel.post({
url: "/emails/",
- data: data,
- success: function () {
+ data,
+ success() {
$("#smtp_form_status").show();
setTimeout(() => {
$("#smtp_form_status").hide();
diff --git a/static/js/portico/integrations.js b/static/js/portico/integrations.js
index 0b051250ee..7c38d56e73 100644
--- a/static/js/portico/integrations.js
+++ b/static/js/portico/integrations.js
@@ -191,7 +191,7 @@ function hide_catalog_show_integration() {
url: "/integrations/doc-html/" + state.integration,
dataType: "html",
success: hide_catalog,
- error: function (err) {
+ error(err) {
blueslip.error(
"Integration documentation for '" + state.integration + "' not found.",
err,
@@ -343,13 +343,13 @@ function integration_events() {
$(".integration-instruction-block").on("click", "a .integration-category", (e) => {
const category = $(e.target).data("category");
- dispatch("SHOW_CATEGORY", {category: category});
+ dispatch("SHOW_CATEGORY", {category});
return false;
});
$(".integrations a .integration-category").on("click", (e) => {
const category = $(e.target).data("category");
- dispatch("CHANGE_CATEGORY", {category: category});
+ dispatch("CHANGE_CATEGORY", {category});
toggle_categories_dropdown();
return false;
});
@@ -357,7 +357,7 @@ function integration_events() {
$(".integrations a .integration-lozenge").on("click", (e) => {
if (!$(e.target).closest(".integration-lozenge").hasClass("integration-create-your-own")) {
const integration = $(e.target).closest(".integration-lozenge").data("name");
- dispatch("SHOW_INTEGRATION", {integration: integration});
+ dispatch("SHOW_INTEGRATION", {integration});
return false;
}
});
diff --git a/static/js/portico/integrations_dev_panel.js b/static/js/portico/integrations_dev_panel.js
index 351530a181..d9fb21af40 100644
--- a/static/js/portico/integrations_dev_panel.js
+++ b/static/js/portico/integrations_dev_panel.js
@@ -13,22 +13,22 @@ const clear_handlers = {
topic_name: "#topic_name",
URL: "#URL",
results_notice: "#results_notice",
- bot_name: function () {
+ bot_name() {
$("#bot_name").children()[0].selected = true;
},
- integration_name: function () {
+ integration_name() {
$("#integration_name").children()[0].selected = true;
},
- fixture_name: function () {
+ fixture_name() {
$("#fixture_name").empty();
},
- fixture_body: function () {
+ fixture_body() {
$("#fixture_body")[0].value = "";
},
- custom_http_headers: function () {
+ custom_http_headers() {
$("#custom_http_headers")[0].value = "{}";
},
- results: function () {
+ results() {
$("#idp-results")[0].value = "";
},
};
@@ -223,7 +223,7 @@ function get_fixtures(integration_name) {
url: "/devtools/integrations/" + integration_name + "/fixtures",
// Since the user may add or modify fixtures as they edit.
idempotent: false,
- success: function (response) {
+ success(response) {
loaded_fixtures.set(integration_name, response.fixtures);
load_fixture_options(integration_name);
return;
@@ -270,11 +270,11 @@ function send_webhook_fixture_message() {
channel.post({
url: "/devtools/integrations/check_send_webhook_fixture_message",
- data: {url: url, body: body, custom_headers: custom_headers, is_json: is_json},
- beforeSend: function (xhr) {
+ data: {url, body, custom_headers, is_json},
+ beforeSend(xhr) {
xhr.setRequestHeader("X-CSRFToken", csrftoken);
},
- success: function (response) {
+ success(response) {
// If the previous fixture body was sent successfully,
// then we should change the success message up a bit to
// let the user easily know that this fixture body was
@@ -305,11 +305,11 @@ function send_all_fixture_messages() {
const csrftoken = $("#csrftoken").val();
channel.post({
url: "/devtools/integrations/send_all_webhook_fixture_messages",
- data: {url: url, integration_name: integration},
- beforeSend: function (xhr) {
+ data: {url, integration_name: integration},
+ beforeSend(xhr) {
xhr.setRequestHeader("X-CSRFToken", csrftoken);
},
- success: function (response) {
+ success(response) {
set_results(response);
},
error: handle_unsuccessful_response,
diff --git a/static/js/portico/signup.js b/static/js/portico/signup.js
index 4bb166f851..bf9fe1e19a 100644
--- a/static/js/portico/signup.js
+++ b/static/js/portico/signup.js
@@ -36,7 +36,7 @@ $(() => {
new_password1: "password_strength",
},
errorElement: "p",
- errorPlacement: function (error, element) {
+ errorPlacement(error, element) {
// NB: this is called at most once, when the error element
// is created.
element.next(".help-inline.alert.alert-error").remove();
@@ -109,12 +109,12 @@ $(() => {
$("#send_confirm").validate({
errorElement: "div",
- errorPlacement: function (error) {
+ errorPlacement(error) {
$(".email-frontend-error").empty();
$("#send_confirm .alert.email-backend-error").remove();
error.appendTo(".email-frontend-error").addClass("text-error");
},
- success: function () {
+ success() {
$("#errors").empty();
},
});
@@ -141,18 +141,18 @@ $(() => {
$("#login_form").validate({
errorClass: "text-error",
wrapper: "div",
- submitHandler: function (form) {
+ submitHandler(form) {
$("#login_form").find(".loader").css("display", "inline-block");
$("#login_form").find("button .text").hide();
form.submit();
},
- invalidHandler: function () {
+ invalidHandler() {
// this removes all previous errors that were put on screen
// by the server.
$("#login_form .alert.alert-error").remove();
},
- showErrors: function (error_map) {
+ showErrors(error_map) {
if (error_map.password) {
$("#login_form .alert.alert-error").remove();
}
diff --git a/static/js/presence.js b/static/js/presence.js
index fcb9df1e2b..b4057d1f64 100644
--- a/static/js/presence.js
+++ b/static/js/presence.js
@@ -75,20 +75,20 @@ exports.status_from_raw = function (raw) {
if (age(active_timestamp) < OFFLINE_THRESHOLD_SECS) {
return {
status: "active",
- last_active: last_active,
+ last_active,
};
}
if (age(idle_timestamp) < OFFLINE_THRESHOLD_SECS) {
return {
status: "idle",
- last_active: last_active,
+ last_active,
};
}
return {
status: "offline",
- last_active: last_active,
+ last_active,
};
};
@@ -186,7 +186,7 @@ exports.set_info = function (presences, server_timestamp) {
}
const raw = {
- server_timestamp: server_timestamp,
+ server_timestamp,
active_timestamp: info.active_timestamp || undefined,
idle_timestamp: info.idle_timestamp || undefined,
};
@@ -230,7 +230,7 @@ exports.update_info_for_small_realm = function () {
}
exports.presence_info.set(user_id, {
- status: status,
+ status,
last_active: undefined,
});
}
diff --git a/static/js/reactions.js b/static/js/reactions.js
index 962fbc0e24..f3acea867f 100644
--- a/static/js/reactions.js
+++ b/static/js/reactions.js
@@ -36,7 +36,7 @@ function get_message(message_id) {
function create_reaction(message_id, reaction_info) {
return {
- message_id: message_id,
+ message_id,
user_id: page_params.user_id,
local_id: exports.get_local_reaction_id(reaction_info),
reaction_type: reaction_info.reaction_type,
@@ -61,8 +61,8 @@ function update_ui_and_send_reaction_ajax(message_id, reaction_info) {
const args = {
url: "/json/messages/" + message_id + "/reactions",
data: reaction_info,
- success: function () {},
- error: function (xhr) {
+ success() {},
+ error(xhr) {
const response = channel.xhr_error_message("Error sending reaction", xhr);
// Errors are somewhat common here, due to race conditions
// where the user tries to add/remove the reaction when there is already
@@ -86,7 +86,7 @@ exports.toggle_emoji_reaction = function (message_id, emoji_name) {
// method. This codepath is to be used only where there is no chance of an
// user interacting with a deactivated realm emoji like emoji picker.
const reaction_info = {
- emoji_name: emoji_name,
+ emoji_name,
};
if (emoji.active_realm_emojis.has(emoji_name)) {
@@ -219,8 +219,8 @@ exports.add_reaction = function (event) {
exports.update_user_fields(r);
} else {
exports.add_clean_reaction({
- message: message,
- local_id: local_id,
+ message,
+ local_id,
user_ids: [user_id],
reaction_type: event.reaction_type,
emoji_name: event.emoji_name,
@@ -229,11 +229,11 @@ exports.add_reaction = function (event) {
}
const opts = {
- message_id: message_id,
+ message_id,
reaction_type: event.reaction_type,
emoji_name: event.emoji_name,
emoji_code: event.emoji_code,
- user_id: user_id,
+ user_id,
};
if (r) {
@@ -279,9 +279,9 @@ exports.view.insert_new_reaction = function (opts) {
const user_list = [user_id];
const context = {
- message_id: message_id,
- emoji_name: emoji_name,
- emoji_code: emoji_code,
+ message_id,
+ emoji_name,
+ emoji_code,
};
const new_label = generate_title(emoji_name, user_list);
@@ -345,12 +345,12 @@ exports.remove_reaction = function (event) {
}
exports.view.remove_reaction({
- message_id: message_id,
- reaction_type: reaction_type,
- emoji_name: emoji_name,
- emoji_code: emoji_code,
+ message_id,
+ reaction_type,
+ emoji_name,
+ emoji_code,
user_list: r.user_ids,
- user_id: user_id,
+ user_id,
});
};
@@ -467,9 +467,9 @@ exports.set_clean_reactions = function (message) {
const user_ids = user_map.get(local_id);
exports.add_clean_reaction({
- message: message,
- local_id: local_id,
- user_ids: user_ids,
+ message,
+ local_id,
+ user_ids,
reaction_type: reaction.reaction_type,
emoji_name: reaction.emoji_name,
emoji_code: reaction.emoji_code,
diff --git a/static/js/realm_logo.js b/static/js/realm_logo.js
index 10576c8adf..e05dd24eb2 100644
--- a/static/js/realm_logo.js
+++ b/static/js/realm_logo.js
@@ -34,7 +34,7 @@ exports.build_realm_logo_widget = function (upload_function, is_night) {
e.stopPropagation();
channel.del({
url: "/json/realm/logo",
- data: data,
+ data,
});
});
diff --git a/static/js/recent_topics.js b/static/js/recent_topics.js
index 22d6f9f302..f9e65c1cb1 100644
--- a/static/js/recent_topics.js
+++ b/static/js/recent_topics.js
@@ -180,22 +180,22 @@ function format_topic(topic_data) {
return {
// stream info
- stream_id: stream_id,
- stream: stream,
+ stream_id,
+ stream,
stream_color: stream_info.color,
invite_only: stream_info.invite_only,
is_web_public: stream_info.is_web_public,
stream_url: hash_util.by_stream_uri(stream_id),
- topic: topic,
+ topic,
topic_key: get_topic_key(stream_id, topic),
- unread_count: unread_count,
- last_msg_time: last_msg_time,
+ unread_count,
+ last_msg_time,
topic_url: hash_util.by_stream_topic_uri(stream_id, topic),
senders: senders_info,
other_senders_count: Math.max(0, all_senders.length - MAX_AVATAR),
- muted: muted,
- topic_muted: topic_muted,
+ muted,
+ topic_muted,
participated: topic_data.participated,
full_last_msg_date_time: full_datetime.date + " " + full_datetime.time,
};
@@ -419,19 +419,19 @@ exports.complete_rerender = function () {
topics_widget = list_render.create(container, mapped_topic_values, {
name: "recent_topics_table",
parent_container: $("#recent_topics_table"),
- modifier: function (item) {
+ modifier(item) {
return render_recent_topic_row(format_topic(item));
},
filter: {
// We use update_filters_view & filters_should_hide_topic to do all the
// filtering for us, which is called using click_handlers.
- predicate: function (topic_data) {
+ predicate(topic_data) {
return !exports.filters_should_hide_topic(topic_data);
},
},
sort_fields: {
- stream_sort: stream_sort,
- topic_sort: topic_sort,
+ stream_sort,
+ topic_sort,
},
html_selector: get_topic_row,
simplebar_container: $("#recent_topics_table .table_fix_head"),
@@ -443,7 +443,7 @@ exports.launch = function () {
overlays.open_overlay({
name: "recent_topics",
overlay: $("#recent_topics_overlay"),
- on_close: function () {
+ on_close() {
hashchange.exit_overlay();
},
});
diff --git a/static/js/reminder.js b/static/js/reminder.js
index 6a19af89fc..a88cf73b95 100644
--- a/static/js/reminder.js
+++ b/static/js/reminder.js
@@ -119,13 +119,13 @@ exports.do_set_reminder_for_message = function (message_id, timestamp) {
channel.get({
url: "/json/messages/" + message.id,
idempotent: true,
- success: function (data) {
+ success(data) {
if (current_msg_list === msg_list) {
message.raw_content = data.raw_content;
exports.do_set_reminder_for_message(message_id, timestamp);
}
},
- error: error,
+ error,
});
return;
}
diff --git a/static/js/resize.js b/static/js/resize.js
index 8204ff8210..0b6f69fcff 100644
--- a/static/js/resize.js
+++ b/static/js/resize.js
@@ -120,7 +120,7 @@ exports.watch_manual_resize = function (element) {
}
const meta = {
- box: box,
+ box,
height: null,
mousedown: false,
};
diff --git a/static/js/scroll_util.js b/static/js/scroll_util.js
index cbed746c2d..934a96baf3 100644
--- a/static/js/scroll_util.js
+++ b/static/js/scroll_util.js
@@ -29,8 +29,8 @@ exports.scroll_element_into_container = function (elem, container) {
const elem_bottom = elem_top + elem.innerHeight();
const opts = {
- elem_top: elem_top,
- elem_bottom: elem_bottom,
+ elem_top,
+ elem_bottom,
container_height: container.height(),
};
diff --git a/static/js/search.js b/static/js/search.js
index 46d5ee254c..8d473a64a2 100644
--- a/static/js/search.js
+++ b/static/js/search.js
@@ -64,7 +64,7 @@ exports.initialize = function () {
let search_map = new Map();
search_query_box.typeahead({
- source: function (query) {
+ source(query) {
let base_query = "";
if (page_params.search_pills_enabled) {
base_query = search_pill.get_search_string_for_current_filter(
@@ -80,27 +80,27 @@ exports.initialize = function () {
items: search_suggestion.max_num_of_search_results,
helpOnEmptyStrings: true,
naturalSearch: true,
- highlighter: function (item) {
+ highlighter(item) {
const obj = search_map.get(item);
return obj.description;
},
- matcher: function () {
+ matcher() {
return true;
},
- updater: function (search_string) {
+ updater(search_string) {
if (page_params.search_pills_enabled) {
search_pill.append_search_string(search_string, search_pill_widget.widget);
return search_query_box.val();
}
return exports.narrow_or_search_for_term(search_string);
},
- sorter: function (items) {
+ sorter(items) {
return items;
},
stopAdvance: page_params.search_pills_enabled,
advanceKeyCodes: [8],
- on_move: function () {
+ on_move() {
if (page_params.search_pills_enabled) {
ui_util.place_caret_at_end(search_query_box[0]);
return true;
diff --git a/static/js/search_pill.js b/static/js/search_pill.js
index fa4fe2e6b2..90c47e0503 100644
--- a/static/js/search_pill.js
+++ b/static/js/search_pill.js
@@ -3,7 +3,7 @@ exports.create_item_from_search_string = function (search_string) {
const description = Filter.describe(operator);
return {
display_value: search_string,
- description: description,
+ description,
};
};
diff --git a/static/js/search_suggestion.js b/static/js/search_suggestion.js
index d7588c90cc..a8d2f36c38 100644
--- a/static/js/search_suggestion.js
+++ b/static/js/search_suggestion.js
@@ -109,7 +109,7 @@ function get_stream_suggestions(last, operators) {
negated: last.negated,
};
const search_string = Filter.unparse([term]);
- return {description: description, search_string: search_string};
+ return {description, search_string};
});
return objs;
@@ -163,7 +163,7 @@ function get_group_suggestions(last, operators) {
const term = {
operator: "pm-with",
operand: all_but_last_part + "," + person.email,
- negated: negated,
+ negated,
};
const name = highlight_person(person);
const description =
@@ -173,7 +173,7 @@ function get_group_suggestions(last, operators) {
terms = [{operator: "is", operand: "private"}, term];
}
const search_string = Filter.unparse(terms);
- return {description: description, search_string: search_string};
+ return {description, search_string};
});
return suggestions;
@@ -256,7 +256,7 @@ function get_person_suggestions(people_getter, last, operators, autocomplete_ope
terms.unshift({operator: "is", operand: "private"});
}
const search_string = Filter.unparse(terms);
- return {description: description, search_string: search_string};
+ return {description, search_string};
});
return objs;
@@ -354,7 +354,7 @@ function get_topic_suggestions(last, operators) {
topics.sort();
return topics.map((topic) => {
- const topic_term = {operator: "topic", operand: topic, negated: negated};
+ const topic_term = {operator: "topic", operand: topic, negated};
const operators = suggest_operators.concat([topic_term]);
return format_as_suggestion(operators);
});
@@ -521,14 +521,14 @@ function get_sent_by_me_suggestions(last, operators) {
return [
{
search_string: sender_query,
- description: description,
+ description,
},
];
} else if (from_query.startsWith(last_string) || from_me_query.startsWith(last_string)) {
return [
{
search_string: from_query,
- description: description,
+ description,
},
];
}
@@ -551,7 +551,7 @@ function get_operator_suggestions(last) {
choices = choices.filter((choice) => common.phrase_match(last_operand, choice));
return choices.map((choice) => {
- const op = [{operator: choice, operand: "", negated: negated}];
+ const op = [{operator: choice, operand: "", negated}];
return format_as_suggestion(op);
});
}
@@ -730,8 +730,8 @@ exports.finalize_search_result = function (result) {
const strings = result.map((obj) => obj.search_string);
return {
- strings: strings,
- lookup_table: lookup_table,
+ strings,
+ lookup_table,
};
};
diff --git a/static/js/sent_messages.js b/static/js/sent_messages.js
index 10f41e635f..94b3f391cc 100644
--- a/static/js/sent_messages.js
+++ b/static/js/sent_messages.js
@@ -14,7 +14,7 @@ function report_send_time(send_time, receive_time, locally_echoed, rendered_chan
const data = {
time: send_time.toString(),
received: receive_time.toString(),
- locally_echoed: locally_echoed,
+ locally_echoed,
};
if (locally_echoed) {
@@ -23,7 +23,7 @@ function report_send_time(send_time, receive_time, locally_echoed, rendered_chan
channel.post({
url: "/json/report/send_times",
- data: data,
+ data,
});
}
diff --git a/static/js/server_events.js b/static/js/server_events.js
index 90f7e96a38..1ca9e04fb2 100644
--- a/static/js/server_events.js
+++ b/static/js/server_events.js
@@ -190,7 +190,7 @@ function get_events(options) {
data: get_events_params,
idempotent: true,
timeout: page_params.poll_timeout,
- success: function (data) {
+ success(data) {
exports.suspect_offline = false;
try {
get_events_xhr = undefined;
@@ -207,7 +207,7 @@ function get_events(options) {
}
get_events_timeout = setTimeout(get_events, 0);
},
- error: function (xhr, error_type) {
+ error(xhr, error_type) {
try {
get_events_xhr = undefined;
// If we're old enough that our message queue has been
diff --git a/static/js/settings.js b/static/js/settings.js
index 99d956f78e..384048a51c 100644
--- a/static/js/settings.js
+++ b/static/js/settings.js
@@ -60,7 +60,7 @@ exports.build_page = function () {
const rendered_settings_tab = render_settings_tab({
full_name: people.my_full_name(),
- page_params: page_params,
+ page_params,
enable_sound_select:
page_params.enable_sounds || page_params.enable_stream_audible_notifications,
zuliprc: "zuliprc",
diff --git a/static/js/settings_account.js b/static/js/settings_account.js
index 860f41fc66..afd7201b8b 100644
--- a/static/js/settings_account.js
+++ b/static/js/settings_account.js
@@ -167,14 +167,14 @@ exports.append_custom_profile_fields = function (element_id, user_id) {
}
const html = render_settings_custom_user_profile_field({
- field: field,
+ field,
field_type: all_field_template_types.get(field.type),
- field_value: field_value,
+ field_value,
is_long_text_field: field.type === all_field_types.LONG_TEXT.id,
is_user_field: field.type === all_field_types.USER.id,
is_date_field: field.type === all_field_types.DATE.id,
- is_choice_field: is_choice_field,
- field_choices: field_choices,
+ is_choice_field,
+ field_choices,
});
$(element_id).append(html);
});
@@ -300,8 +300,8 @@ exports.set_up = function () {
function request_api_key(data) {
channel.post({
url: "/json/fetch_api_key",
- data: data,
- success: function (data) {
+ data,
+ success(data) {
$("#get_api_key_password").val("");
$("#api_key_value").text(data.api_key);
// The display property on the error bar is set to important
@@ -311,7 +311,7 @@ exports.set_up = function () {
$("#password_confirmation").hide();
$("#show_api_key").show();
},
- error: function (xhr) {
+ error(xhr) {
ui_report.error(i18n.t("Error"), xhr, $("#api_key_status").expectOne());
$("#show_api_key").hide();
$("#api_key_modal").show();
@@ -340,10 +340,10 @@ exports.set_up = function () {
$("#show_api_key").on("click", "button.regenerate_api_key", (e) => {
channel.post({
url: "/json/users/me/api_key/regenerate",
- success: function (data) {
+ success(data) {
$("#api_key_value").text(data.api_key);
},
- error: function (xhr) {
+ error(xhr) {
$("#user_api_key_error").text(JSON.parse(xhr.responseText).msg).show();
},
});
@@ -447,7 +447,7 @@ exports.set_up = function () {
}
const opts = {
- success_continuation: function () {
+ success_continuation() {
overlays.close_modal("#change_password_modal");
},
error_msg_element: change_password_error,
@@ -478,7 +478,7 @@ exports.set_up = function () {
data.full_name = $(".full_name_change_container").find("input[name='full_name']").val();
const opts = {
- success_continuation: function () {
+ success_continuation() {
overlays.close_modal("#change_full_name_modal");
},
error_msg_element: change_full_name_error,
@@ -500,7 +500,7 @@ exports.set_up = function () {
data.email = $(".email_change_container").find("input[name='email']").val();
const opts = {
- success_continuation: function () {
+ success_continuation() {
if (page_params.development_environment) {
const email_msg = render_settings_dev_env_email_access();
ui_report.success(
@@ -559,7 +559,7 @@ exports.set_up = function () {
10,
);
if (value) {
- fields.push({id: field_id, value: value});
+ fields.push({id: field_id, value});
update_user_custom_profile_fields(fields, channel.patch);
} else {
fields.push(field_id);
@@ -579,11 +579,11 @@ exports.set_up = function () {
setTimeout(() => {
channel.del({
url: "/json/users/me",
- success: function () {
+ success() {
$("#deactivate_self_modal").modal("hide");
window.location.href = "/login/";
},
- error: function (xhr) {
+ error(xhr) {
const error_last_admin = i18n.t(
"Error: Cannot deactivate the only organization administrator.",
);
@@ -645,13 +645,13 @@ exports.set_up = function () {
cache: false,
processData: false,
contentType: false,
- success: function () {
+ success() {
display_avatar_upload_complete();
$("#user-avatar-upload-widget .image_file_input_error").hide();
$("#user-avatar-source").hide();
// Rest of the work is done via the user_events -> avatar_url event we will get
},
- error: function (xhr) {
+ error(xhr) {
display_avatar_upload_complete();
if (page_params.avatar_source === "G") {
$("#user-avatar-source").show();
diff --git a/static/js/settings_bots.js b/static/js/settings_bots.js
index b46747f325..4026818b49 100644
--- a/static/js/settings_bots.js
+++ b/static/js/settings_bots.js
@@ -9,7 +9,7 @@ exports.hide_errors = function () {
};
const focus_tab = {
- add_a_new_bot_tab: function () {
+ add_a_new_bot_tab() {
$("#bots_lists_navbar .active").removeClass("active");
$("#bots_lists_navbar .add-a-new-bot-tab").addClass("active");
$("#add-a-new-bot-form").show();
@@ -17,7 +17,7 @@ const focus_tab = {
$("#inactive_bots_list").hide();
exports.hide_errors();
},
- active_bots_tab: function () {
+ active_bots_tab() {
$("#bots_lists_navbar .active").removeClass("active");
$("#bots_lists_navbar .active-bots-tab").addClass("active");
$("#add-a-new-bot-form").hide();
@@ -25,7 +25,7 @@ const focus_tab = {
$("#inactive_bots_list").hide();
exports.hide_errors();
},
- inactive_bots_tab: function () {
+ inactive_bots_tab() {
$("#bots_lists_navbar .active").removeClass("active");
$("#bots_lists_navbar .inactive-bots-tab").addClass("active");
$("#add-a-new-bot-form").hide();
@@ -263,10 +263,10 @@ exports.set_up = function () {
$("#create_bot_form").validate({
errorClass: "text-error",
- success: function () {
+ success() {
exports.hide_errors();
},
- submitHandler: function () {
+ submitHandler() {
const bot_type = $("#create_bot_type :selected").val();
const full_name = $("#create_bot_name").val();
const short_name =
@@ -306,7 +306,7 @@ exports.set_up = function () {
cache: false,
processData: false,
contentType: false,
- success: function () {
+ success() {
exports.hide_errors();
$("#create_bot_name").val("");
$("#create_bot_short_name").val("");
@@ -325,10 +325,10 @@ exports.set_up = function () {
$("#bots_lists_navbar .add-a-new-bot-tab").removeClass("active");
$("#bots_lists_navbar .active-bots-tab").addClass("active");
},
- error: function (xhr) {
+ error(xhr) {
$("#bot_table_error").text(JSON.parse(xhr.responseText).msg).show();
},
- complete: function () {
+ complete() {
loading.destroy_indicator(spinner);
},
});
@@ -366,13 +366,13 @@ exports.set_up = function () {
channel.del({
url: "/json/bots/" + encodeURIComponent(bot_id),
- success: function () {
+ success() {
const row = $(e.currentTarget).closest("li");
row.hide("slow", () => {
row.remove();
});
},
- error: function (xhr) {
+ error(xhr) {
exports.bot_error(bot_id, xhr);
},
});
@@ -383,7 +383,7 @@ exports.set_up = function () {
channel.post({
url: "/json/users/" + encodeURIComponent(user_id) + "/reactivate",
- error: function (xhr) {
+ error(xhr) {
exports.bot_error(user_id, xhr);
},
});
@@ -394,12 +394,12 @@ exports.set_up = function () {
channel.post({
url: "/json/bots/" + encodeURIComponent(bot_id) + "/api_key/regenerate",
idempotent: true,
- success: function (data) {
+ success(data) {
const row = $(e.currentTarget).closest("li");
row.find(".api_key").find(".value").text(data.api_key);
row.find("api_key_error").hide();
},
- error: function (xhr) {
+ error(xhr) {
const row = $(e.currentTarget).closest("li");
row.find(".api_key_error").text(JSON.parse(xhr.responseText).msg).show();
},
@@ -424,8 +424,8 @@ exports.set_up = function () {
$("#edit_bot_modal").empty();
$("#edit_bot_modal").append(
render_edit_bot({
- bot: bot,
- users_list: users_list,
+ bot,
+ users_list,
}),
);
const avatar_widget = avatar.build_bot_edit_widget($("#settings_page"));
@@ -445,7 +445,7 @@ exports.set_up = function () {
if (bot.bot_type.toString() === OUTGOING_WEBHOOK_BOT_TYPE) {
$("#service_data").append(
render_settings_edit_outgoing_webhook_service({
- service: service,
+ service,
}),
);
$("#edit_service_interface").val(service.interface);
@@ -453,7 +453,7 @@ exports.set_up = function () {
if (bot.bot_type.toString() === EMBEDDED_BOT_TYPE) {
$("#service_data").append(
render_settings_edit_embedded_bot_service({
- service: service,
+ service,
}),
);
}
@@ -462,10 +462,10 @@ exports.set_up = function () {
form.validate({
errorClass: "text-error",
- success: function () {
+ success() {
errors.hide();
},
- submitHandler: function () {
+ submitHandler() {
const bot_id = parseInt(form.attr("data-user-id"), 10);
const type = form.attr("data-type");
@@ -503,7 +503,7 @@ exports.set_up = function () {
cache: false,
processData: false,
contentType: false,
- success: function (data) {
+ success(data) {
loading.destroy_indicator(spinner);
errors.hide();
edit_button.show();
@@ -520,7 +520,7 @@ exports.set_up = function () {
}
overlays.close_modal("#edit_bot_modal");
},
- error: function (xhr) {
+ error(xhr) {
loading.destroy_indicator(spinner);
edit_button.show();
errors.text(JSON.parse(xhr.responseText).msg).show();
@@ -538,7 +538,7 @@ exports.set_up = function () {
});
new ClipboardJS("#copy_zuliprc", {
- text: function (trigger) {
+ text(trigger) {
const bot_info = $(trigger).closest(".bot-information-box").find(".bot_info");
const bot_id = parseInt(bot_info.attr("data-user-id"), 10);
const bot = bot_data.get(bot_id);
diff --git a/static/js/settings_config.js b/static/js/settings_config.js
index 41921a4947..05f96b7d4a 100644
--- a/static/js/settings_config.js
+++ b/static/js/settings_config.js
@@ -308,10 +308,10 @@ exports.all_notifications = () => ({
},
],
settings: {
- desktop_notification_settings: desktop_notification_settings,
- mobile_notification_settings: mobile_notification_settings,
- email_notification_settings: email_notification_settings,
- presence_notification_settings: presence_notification_settings,
+ desktop_notification_settings,
+ mobile_notification_settings,
+ email_notification_settings,
+ presence_notification_settings,
},
show_push_notifications_tooltip: {
push_notifications: !page_params.realm_push_notifications_enabled,
diff --git a/static/js/settings_display.js b/static/js/settings_display.js
index b40afca53f..15b7d83b2c 100644
--- a/static/js/settings_display.js
+++ b/static/js/settings_display.js
@@ -128,9 +128,9 @@ exports.set_up = function () {
channel.patch({
url: "/json/settings/display",
- data: data,
- success: function () {},
- error: function (xhr) {
+ data,
+ success() {},
+ error(xhr) {
ui_report.error(
settings_ui.strings.failure,
xhr,
diff --git a/static/js/settings_emoji.js b/static/js/settings_emoji.js
index 638d02e010..c6873459fa 100644
--- a/static/js/settings_emoji.js
+++ b/static/js/settings_emoji.js
@@ -78,7 +78,7 @@ exports.populate_emoji = function (emoji_data) {
const emoji_table = $("#admin_emoji_table").expectOne();
list_render.create(emoji_table, Object.values(emoji_data), {
name: "emoji_list",
- modifier: function (item) {
+ modifier(item) {
if (item.deactivated !== true) {
return render_admin_emoji_list({
emoji: {
@@ -94,10 +94,10 @@ exports.populate_emoji = function (emoji_data) {
},
filter: {
element: emoji_table.closest(".settings-section").find(".search"),
- predicate: function (item, value) {
+ predicate(item, value) {
return item.name.toLowerCase().includes(value);
},
- onupdate: function () {
+ onupdate() {
ui.reset_scrollbar(emoji_table);
},
},
@@ -150,10 +150,10 @@ exports.set_up = function () {
channel.del({
url: "/json/realm/emoji/" + encodeURIComponent(btn.attr("data-emoji-name")),
- error: function (xhr) {
+ error(xhr) {
ui_report.generic_row_button_error(xhr, btn);
},
- success: function () {
+ success() {
const row = btn.parents("tr");
row.remove();
},
@@ -185,14 +185,14 @@ exports.set_up = function () {
cache: false,
processData: false,
contentType: false,
- success: function () {
+ success() {
$("#admin-emoji-status").hide();
ui_report.success(i18n.t("Custom emoji added!"), emoji_status);
$("form.admin-emoji-form input[type='text']").val("");
$("#admin_emoji_submit").removeAttr("disabled");
emoji_widget.clear();
},
- error: function (xhr) {
+ error(xhr) {
$("#admin-emoji-status").hide();
const errors = JSON.parse(xhr.responseText).msg;
xhr.responseText = JSON.stringify({msg: errors});
diff --git a/static/js/settings_exports.js b/static/js/settings_exports.js
index 1ba0a6faf0..f2e5ed7dcc 100644
--- a/static/js/settings_exports.js
+++ b/static/js/settings_exports.js
@@ -27,7 +27,7 @@ exports.populate_exports_table = function (exports) {
const exports_table = $("#admin_exports_table").expectOne();
list_render.create(exports_table, Object.values(exports), {
name: "admin_exports_list",
- modifier: function (data) {
+ modifier(data) {
let failed_timestamp = data.failed_timestamp;
let deleted_timestamp = data.deleted_timestamp;
@@ -60,10 +60,10 @@ exports.populate_exports_table = function (exports) {
},
filter: {
element: exports_table.closest(".settings-section").find(".search"),
- predicate: function (item, value) {
+ predicate(item, value) {
return people.get_full_name(item.acting_user_id).toLowerCase().includes(value);
},
- onupdate: function () {
+ onupdate() {
ui.reset_scrollbar(exports_table);
},
},
@@ -93,14 +93,14 @@ exports.set_up = function () {
channel.post({
url: "/json/export/realm",
- success: function () {
+ success() {
ui_report.success(
i18n.t("Export started. Check back in a few minutes."),
export_status,
4000,
);
},
- error: function (xhr) {
+ error(xhr) {
ui_report.error(i18n.t("Export failed"), xhr, export_status);
},
});
@@ -109,7 +109,7 @@ exports.set_up = function () {
// Do an initial population of the table
channel.get({
url: "/json/export/realm",
- success: function (data) {
+ success(data) {
exports.populate_exports_table(data.exports);
},
});
@@ -121,7 +121,7 @@ exports.set_up = function () {
channel.del({
url: "/json/export/realm/" + encodeURIComponent(btn.attr("data-export-id")),
- error: function (xhr) {
+ error(xhr) {
ui_report.generic_row_button_error(xhr, btn);
},
// No success function, since UI updates are done via server_events
diff --git a/static/js/settings_invites.js b/static/js/settings_invites.js
index 540ee741b5..f1edef31ca 100644
--- a/static/js/settings_invites.js
+++ b/static/js/settings_invites.js
@@ -43,7 +43,7 @@ function populate_invites(invites_data) {
list_render.create(invites_table, invites_data.invites, {
name: "admin_invites_list",
- modifier: function (item) {
+ modifier(item) {
item.invited_absolute_time = timerender.absolute_time(item.invited * 1000);
item.is_admin = page_params.is_admin;
item.disable_buttons =
@@ -54,7 +54,7 @@ function populate_invites(invites_data) {
},
filter: {
element: invites_table.closest(".settings-section").find(".search"),
- predicate: function (item, value) {
+ predicate(item, value) {
const referrer_email = people.get_by_user_id(item.invited_by_user_id).email;
const referrer_email_matched = referrer_email.toLowerCase().includes(value);
if (item.is_multiuse) {
@@ -100,11 +100,11 @@ function do_revoke_invite() {
url = "/json/invites/multiuse/" + meta.invite_id;
}
channel.del({
- url: url,
- error: function (xhr) {
+ url,
+ error(xhr) {
ui_report.generic_row_button_error(xhr, revoke_button);
},
- success: function () {
+ success() {
meta.current_revoke_invite_user_modal_row.remove();
},
});
@@ -124,7 +124,7 @@ exports.set_up = function (initialize_event_handlers) {
url: "/json/invites",
idempotent: true,
timeout: 10 * 1000,
- success: function (data) {
+ success(data) {
exports.on_load_success(data, initialize_event_handlers);
},
error: failed_listing_invites,
@@ -150,8 +150,8 @@ exports.on_load_success = function (invites_data, initialize_event_handlers) {
meta.is_multiuse = $(e.currentTarget).attr("data-is-multiuse");
const ctx = {
is_multiuse: meta.is_multiuse === "true",
- email: email,
- referred_by: referred_by,
+ email,
+ referred_by,
};
const rendered_revoke_modal = render_settings_revoke_invite_modal(ctx);
$("#revoke_invite_modal_holder").html(rendered_revoke_modal);
@@ -199,10 +199,10 @@ exports.on_load_success = function (invites_data, initialize_event_handlers) {
resend_button.prop("disabled", true).text(i18n.t("Working…"));
channel.post({
url: "/json/invites/" + meta.invite_id + "/resend",
- error: function (xhr) {
+ error(xhr) {
ui_report.generic_row_button_error(xhr, resend_button);
},
- success: function (data) {
+ success(data) {
resend_button.text(i18n.t("Sent!"));
resend_button.removeClass("resend btn-warning").addClass("sea-green");
data.timestamp = timerender.absolute_time(data.timestamp * 1000);
diff --git a/static/js/settings_linkifiers.js b/static/js/settings_linkifiers.js
index d9198c101a..f58e51a1ba 100644
--- a/static/js/settings_linkifiers.js
+++ b/static/js/settings_linkifiers.js
@@ -39,7 +39,7 @@ exports.populate_filters = function (filters_data) {
const filters_table = $("#admin_filters_table").expectOne();
list_render.create(filters_table, filters_data, {
name: "linkifiers_list",
- modifier: function (filter) {
+ modifier(filter) {
return render_admin_filter_list({
filter: {
pattern: filter[0],
@@ -51,12 +51,12 @@ exports.populate_filters = function (filters_data) {
},
filter: {
element: filters_table.closest(".settings-section").find(".search"),
- predicate: function (item, value) {
+ predicate(item, value) {
return (
item[0].toLowerCase().includes(value) || item[1].toLowerCase().includes(value)
);
},
- onupdate: function () {
+ onupdate() {
ui.reset_scrollbar(filters_table);
},
},
@@ -93,10 +93,10 @@ exports.build_page = function () {
channel.del({
url: "/json/realm/filters/" + encodeURIComponent(btn.attr("data-filter-id")),
- error: function (xhr) {
+ error(xhr) {
ui_report.generic_row_button_error(xhr, btn);
},
- success: function () {
+ success() {
const row = btn.parents("tr");
row.remove();
},
@@ -125,14 +125,14 @@ exports.build_page = function () {
channel.post({
url: "/json/realm/filters",
data: $(this).serialize(),
- success: function (data) {
+ success(data) {
$("#filter_pattern").val("");
$("#filter_format_string").val("");
add_filter_button.removeAttr("disabled");
filter.id = data.id;
ui_report.success(i18n.t("Custom filter added!"), filter_status);
},
- error: function (xhr) {
+ error(xhr) {
const errors = JSON.parse(xhr.responseText).errors;
add_filter_button.removeAttr("disabled");
if (errors.pattern !== undefined) {
diff --git a/static/js/settings_notifications.js b/static/js/settings_notifications.js
index b8d4df73ee..a8ef2e197e 100644
--- a/static/js/settings_notifications.js
+++ b/static/js/settings_notifications.js
@@ -12,7 +12,7 @@ exports.get_notifications_table_row_data = function (notify_settings) {
};
}
const checkbox = {
- setting_name: setting_name,
+ setting_name,
is_disabled: false,
};
if (column === "mobile") {
@@ -52,7 +52,7 @@ function rerender_ui() {
for (const stream of unmatched_streams) {
unmatched_streams_table.append(
render_stream_specific_notification_row({
- stream: stream,
+ stream,
stream_specific_notification_settings:
settings_config.stream_specific_notification_settings,
is_disabled: settings_config.all_notifications().show_push_notifications_tooltip,
diff --git a/static/js/settings_org.js b/static/js/settings_org.js
index 7f30840a59..760bb9b17e 100644
--- a/static/js/settings_org.js
+++ b/static/js/settings_org.js
@@ -50,7 +50,7 @@ exports.maybe_disable_widgets = function () {
exports.get_sorted_options_list = function (option_values_object) {
const options_list = Object.keys(option_values_object).map((key) => ({
...option_values_object[key],
- key: key,
+ key,
}));
let comparator = (x, y) => x.order - y.order;
if (!options_list[0].order) {
@@ -302,7 +302,7 @@ exports.populate_realm_domains = function (realm_domains) {
if (domains.length === 0) {
domains = i18n.t("None");
}
- $("#allowed_domains_label").text(i18n.t("Allowed domains: __domains__", {domains: domains}));
+ $("#allowed_domains_label").text(i18n.t("Allowed domains: __domains__", {domains}));
const realm_domains_table_body = $("#realm_domains_table tbody").expectOne();
realm_domains_table_body.find("tr").remove();
@@ -310,7 +310,7 @@ exports.populate_realm_domains = function (realm_domains) {
for (const realm_domain of realm_domains) {
realm_domains_table_body.append(
render_settings_admin_realm_domains_list({
- realm_domain: realm_domain,
+ realm_domain,
}),
);
}
@@ -699,12 +699,12 @@ exports.build_page = function () {
exports.change_save_button_state(save_btn_container, "saving");
channel.patch({
url: "/json/realm",
- data: data,
- success: function () {
+ data,
+ success() {
failed_alert_elem.hide();
exports.change_save_button_state(save_btn_container, "succeeded");
},
- error: function (xhr) {
+ error(xhr) {
exports.change_save_button_state(save_btn_container, "failed");
save_button.hide();
ui_report.error(i18n.t("Save failed"), xhr, failed_alert_elem);
@@ -933,12 +933,12 @@ exports.build_page = function () {
const realm_domains_info = $(".realm_domains_info");
channel.del({
- url: url,
- success: function () {
+ url,
+ success() {
ui_report.success(i18n.t("Deleted successfully!"), realm_domains_info);
fade_status_element(realm_domains_info);
},
- error: function (xhr) {
+ error(xhr) {
ui_report.error(i18n.t("Failed"), xhr, realm_domains_info);
fade_status_element(realm_domains_info);
},
@@ -957,8 +957,8 @@ exports.build_page = function () {
channel.post({
url: "/json/realm/domains",
- data: data,
- success: function () {
+ data,
+ success() {
$("#add-realm-domain-widget .new-realm-domain").val("");
$("#add-realm-domain-widget .new-realm-domain-allow-subdomains").prop(
"checked",
@@ -967,7 +967,7 @@ exports.build_page = function () {
ui_report.success(i18n.t("Added successfully!"), realm_domains_info);
fade_status_element(realm_domains_info);
},
- error: function (xhr) {
+ error(xhr) {
ui_report.error(i18n.t("Failed"), xhr, realm_domains_info);
fade_status_element(realm_domains_info);
},
@@ -985,27 +985,27 @@ exports.build_page = function () {
};
channel.patch({
- url: url,
- data: data,
- success: function () {
+ url,
+ data,
+ success() {
if (allow_subdomains) {
ui_report.success(
i18n.t("Update successful: Subdomains allowed for __domain__", {
- domain: domain,
+ domain,
}),
realm_domains_info,
);
} else {
ui_report.success(
i18n.t("Update successful: Subdomains no longer allowed for __domain__", {
- domain: domain,
+ domain,
}),
realm_domains_info,
);
}
fade_status_element(realm_domains_info);
},
- error: function (xhr) {
+ error(xhr) {
ui_report.error(i18n.t("Failed"), xhr, realm_domains_info);
fade_status_element(realm_domains_info);
},
@@ -1052,15 +1052,15 @@ exports.build_page = function () {
realm_icon_logo_upload_start(spinner, upload_text, delete_button);
error_field.hide();
channel.post({
- url: url,
+ url,
data: form_data,
cache: false,
processData: false,
contentType: false,
- success: function () {
+ success() {
realm_icon_logo_upload_complete(spinner, upload_text, delete_button);
},
- error: function (xhr) {
+ error(xhr) {
realm_icon_logo_upload_complete(spinner, upload_text, delete_button);
ui_report.error("", xhr, error_field);
},
@@ -1087,7 +1087,7 @@ exports.build_page = function () {
}
channel.post({
url: "/json/realm/deactivate",
- error: function (xhr) {
+ error(xhr) {
ui_report.error(
i18n.t("Failed"),
xhr,
diff --git a/static/js/settings_profile_fields.js b/static/js/settings_profile_fields.js
index e5affae652..62ebe88a81 100644
--- a/static/js/settings_profile_fields.js
+++ b/static/js/settings_profile_fields.js
@@ -65,7 +65,7 @@ function read_choice_field_data_from_form(field_elem) {
.each(function () {
const text = $(this).find("input")[0].value;
if (text) {
- field_data[field_order - 1] = {text: text, order: field_order.toString()};
+ field_data[field_order - 1] = {text, order: field_order.toString()};
field_order += 1;
}
});
@@ -167,7 +167,7 @@ function create_profile_field(e) {
const form_data = {
name: $("#profile_field_name").val(),
- field_type: field_type,
+ field_type,
hint: $("#profile_field_hint").val(),
field_data: JSON.stringify(field_data),
};
@@ -221,7 +221,7 @@ exports.parse_field_choices_from_field_data = function (field_data) {
const choices = [];
for (const [value, choice] of Object.entries(field_data)) {
choices.push({
- value: value,
+ value,
text: choice.text,
order: choice.order,
});
@@ -263,7 +263,7 @@ function set_up_choices_field_edit_form(profile_field, field_data) {
create_choice_row(choice_list);
update_choice_delete_btn(choice_list, false);
Sortable.create(choice_list[0], {
- onUpdate: function () {},
+ onUpdate() {},
});
}
@@ -388,7 +388,7 @@ exports.do_populate_profile_fields = function (profile_fields_data) {
name: profile_field.name,
hint: profile_field.hint,
type: exports.field_type_id_to_string(profile_field.type),
- choices: choices,
+ choices,
is_choice_field: profile_field.type === field_types.CHOICE.id,
is_external_account_field:
profile_field.type === field_types.EXTERNAL_ACCOUNT.id,
@@ -417,7 +417,7 @@ function set_up_choices_field() {
if (page_params.is_admin) {
const choice_list = $("#profile_field_choices")[0];
Sortable.create(choice_list, {
- onUpdate: function () {},
+ onUpdate() {},
});
}
diff --git a/static/js/settings_streams.js b/static/js/settings_streams.js
index 9864c41e78..fe2a111fa8 100644
--- a/static/js/settings_streams.js
+++ b/static/js/settings_streams.js
@@ -26,7 +26,7 @@ exports.build_default_stream_table = function () {
list_render.create(table, subs, {
name: "default_streams_list",
- modifier: function (item) {
+ modifier(item) {
return render_admin_default_streams_list({
stream: item,
can_modify: page_params.is_admin,
@@ -34,10 +34,10 @@ exports.build_default_stream_table = function () {
},
filter: {
element: table.closest(".settings-section").find(".search"),
- predicate: function (item, query) {
+ predicate(item, query) {
return item.name.toLowerCase().includes(query.toLowerCase());
},
- onupdate: function () {
+ onupdate() {
ui.reset_scrollbar(table);
},
},
@@ -58,15 +58,15 @@ exports.update_default_streams_table = function () {
function make_stream_default(stream_id) {
const data = {
- stream_id: stream_id,
+ stream_id,
};
const default_stream_status = $("#admin-default-stream-status");
default_stream_status.hide();
channel.post({
url: "/json/default_streams",
- data: data,
- error: function (xhr) {
+ data,
+ error(xhr) {
if (xhr.status.toString().charAt(0) === "4") {
ui_report.error(i18n.t("Failed"), xhr, default_stream_status);
} else {
@@ -79,11 +79,11 @@ function make_stream_default(stream_id) {
exports.delete_default_stream = function (stream_id, default_stream_row, alert_element) {
channel.del({
- url: "/json/default_streams" + "?" + $.param({stream_id: stream_id}),
- error: function (xhr) {
+ url: "/json/default_streams" + "?" + $.param({stream_id}),
+ error(xhr) {
ui_report.generic_row_button_error(xhr, alert_element);
},
- success: function () {
+ success() {
default_stream_row.remove();
},
});
@@ -112,10 +112,10 @@ exports.build_page = function () {
$(".create_default_stream").typeahead({
items: 5,
fixed: true,
- source: function () {
+ source() {
return stream_data.get_non_default_stream_names();
},
- highlighter: function (item) {
+ highlighter(item) {
return typeahead_helper.render_typeahead_item({primary: item});
},
});
diff --git a/static/js/settings_toggle.js b/static/js/settings_toggle.js
index c3daa5ab19..0aece5a231 100644
--- a/static/js/settings_toggle.js
+++ b/static/js/settings_toggle.js
@@ -13,7 +13,7 @@ exports.initialize = function () {
{label: i18n.t("Settings"), key: "settings"},
{label: i18n.t("Organization"), key: "organization"},
],
- callback: function (name, key) {
+ callback(name, key) {
if (key === "organization") {
settings_panel_menu.show_org_settings();
} else {
diff --git a/static/js/settings_ui.js b/static/js/settings_ui.js
index e96458c4cf..5f5d69cafc 100644
--- a/static/js/settings_ui.js
+++ b/static/js/settings_ui.js
@@ -37,9 +37,9 @@ exports.do_settings_change = function (request_method, url, data, status_element
}
request_method({
- url: url,
- data: data,
- success: function (reponse_data) {
+ url,
+ data,
+ success(reponse_data) {
setTimeout(() => {
ui_report.success(success_msg, spinner, remove_after);
exports.display_checkmark(spinner);
@@ -52,7 +52,7 @@ exports.do_settings_change = function (request_method, url, data, status_element
}
}
},
- error: function (xhr) {
+ error(xhr) {
if (opts !== undefined && opts.error_msg_element) {
loading.destroy_indicator(spinner);
ui_report.error(exports.strings.failure, xhr, opts.error_msg_element);
diff --git a/static/js/settings_user_groups.js b/static/js/settings_user_groups.js
index f0325d037b..0babb15d56 100644
--- a/static/js/settings_user_groups.js
+++ b/static/js/settings_user_groups.js
@@ -162,7 +162,7 @@ exports.populate_user_groups = function () {
add: JSON.stringify(added),
delete: JSON.stringify(removed),
},
- success: function () {
+ success() {
setTimeout(show_saved_button, 200);
},
});
@@ -185,14 +185,14 @@ exports.populate_user_groups = function () {
channel.patch({
url: "/json/user_groups/" + data.id,
data: {
- name: name,
- description: description,
+ name,
+ description,
},
- success: function () {
+ success() {
user_group_status.hide();
setTimeout(show_saved_button, 200);
},
- error: function (xhr) {
+ error(xhr) {
const errors = JSON.parse(xhr.responseText).msg;
xhr.responseText = JSON.stringify({msg: errors});
ui_report.error(i18n.t("Failed"), xhr, user_group_status);
@@ -305,12 +305,12 @@ exports.set_up = function () {
channel.post({
url: "/json/user_groups/create",
data: group,
- success: function () {
+ success() {
user_group_status.hide();
ui_report.success(i18n.t("User group added!"), user_group_status);
$("form.admin-user-group-form input[type='text']").val("");
},
- error: function (xhr) {
+ error(xhr) {
user_group_status.hide();
const errors = JSON.parse(xhr.responseText).msg;
xhr.responseText = JSON.stringify({msg: errors});
@@ -333,11 +333,11 @@ exports.set_up = function () {
data: {
id: group_id,
},
- success: function () {
+ success() {
user_groups.remove(user_group);
exports.reload();
},
- error: function () {
+ error() {
btn.text(i18n.t("Failed!"));
},
});
@@ -353,7 +353,7 @@ exports.set_up = function () {
confirm_dialog.launch({
parent: modal_parent,
html_heading: i18n.t("Delete user group"),
- html_body: html_body,
+ html_body,
html_yes_button: i18n.t("Delete"),
on_click: delete_user_group,
});
diff --git a/static/js/settings_users.js b/static/js/settings_users.js
index e50637c3b3..70fdc27e60 100644
--- a/static/js/settings_users.js
+++ b/static/js/settings_users.js
@@ -257,7 +257,7 @@ section.bots.create_table = () => {
html_selector: (item) => `tr[data-user-id='${item}']`,
filter: {
element: $bots_table.closest(".settings-section").find(".search"),
- predicate: function (item, value) {
+ predicate(item, value) {
if (!item) {
return false;
}
@@ -286,7 +286,7 @@ section.active.create_table = (active_users) => {
list_render.create($users_table, active_users, {
name: "users_table_list",
get_item: people.get_by_user_id,
- modifier: function (item) {
+ modifier(item) {
const info = human_info(item);
return render_admin_user_list(info);
},
@@ -314,7 +314,7 @@ section.deactivated.create_table = (deactivated_users) => {
list_render.create($deactivated_users_table, deactivated_users, {
name: "deactivated_users_table_list",
get_item: people.get_by_user_id,
- modifier: function (item) {
+ modifier(item) {
const info = human_info(item);
return render_admin_user_list(info);
},
@@ -386,7 +386,7 @@ function open_human_form(person) {
const user_id = person.user_id;
const html = render_admin_human_form({
- user_id: user_id,
+ user_id,
email: person.email,
full_name: person.full_name,
user_role_values: settings_config.user_role_values,
@@ -502,10 +502,10 @@ function confirm_deactivation(row, user_id, status_field) {
const row_deactivate_button = row.find("button.deactivate");
row_deactivate_button.prop("disabled", true).text(i18n.t("Working…"));
const opts = {
- success_continuation: function () {
+ success_continuation() {
update_view_on_deactivate(row);
},
- error_continuation: function () {
+ error_continuation() {
row_deactivate_button.text(i18n.t("Deactivate"));
},
};
@@ -544,10 +544,10 @@ function handle_bot_deactivation(tbody, status_field) {
const url = "/json/bots/" + encodeURIComponent(bot_id);
const opts = {
- success_continuation: function () {
+ success_continuation() {
update_view_on_deactivate(row);
},
- error_continuation: function (xhr) {
+ error_continuation(xhr) {
ui_report.generic_row_button_error(xhr, button_elem);
},
};
@@ -567,10 +567,10 @@ function handle_reactivation(tbody, status_field) {
const data = {};
const opts = {
- success_continuation: function () {
+ success_continuation() {
update_view_on_reactivate(row);
},
- error_continuation: function (xhr) {
+ error_continuation(xhr) {
ui_report.generic_row_button_error(xhr, button_elem);
},
};
diff --git a/static/js/stats/stats.js b/static/js/stats/stats.js
index d88d82fd2c..7d827faf3e 100644
--- a/static/js/stats/stats.js
+++ b/static/js/stats/stats.js
@@ -100,7 +100,7 @@ function populate_messages_sent_over_time(data) {
// Helper functions
function make_traces(dates, values, type, date_formatter) {
const text = dates.map((date) => date_formatter(date));
- const common = {x: dates, type: type, hoverinfo: "none", text: text};
+ const common = {x: dates, type, hoverinfo: "none", text};
return {
human: {
// 5062a0
@@ -147,8 +147,8 @@ function populate_messages_sent_over_time(data) {
function make_rangeselector(x, y, button1, button2) {
return {
- x: x,
- y: y,
+ x,
+ y,
buttons: [
{stepmode: "backward", ...button1},
{stepmode: "backward", ...button2},
@@ -243,8 +243,8 @@ function populate_messages_sent_over_time(data) {
values.bot.push(current.bot);
values.me.push(current.me);
return {
- dates: dates,
- values: values,
+ dates,
+ values,
last_value_is_partial: !is_boundary(
new Date(start_dates[start_dates.length - 1].getTime() + 60 * 60 * 1000),
),
@@ -401,10 +401,10 @@ function compute_summary_chart_data(time_series_data, num_steps, labels_) {
}
const total = values.reduce((a, b) => a + b, 0);
return {
- values: values,
- labels: labels,
+ values,
+ labels,
percentages: round_to_percentages(values, total),
- total: total,
+ total,
};
}
@@ -586,7 +586,7 @@ function populate_messages_sent_by_message_type(data) {
return {
trace: {
values: plot_data.values,
- labels: labels,
+ labels,
type: "pie",
direction: "clockwise",
rotation: -90,
@@ -708,10 +708,10 @@ function populate_number_of_users(data) {
return {
x: end_dates,
y: values,
- type: type,
+ type,
name: i18n.t("Active users"),
hoverinfo: "none",
- text: text,
+ text,
visible: true,
};
}
@@ -786,7 +786,7 @@ function populate_messages_read_over_time(data) {
// Helper functions
function make_traces(dates, values, type, date_formatter) {
const text = dates.map((date) => date_formatter(date));
- const common = {x: dates, type: type, hoverinfo: "none", text: text};
+ const common = {x: dates, type, hoverinfo: "none", text};
return {
everyone: {
name: i18n.t("Everyone"),
@@ -825,8 +825,8 @@ function populate_messages_read_over_time(data) {
function make_rangeselector(x, y, button1, button2) {
return {
- x: x,
- y: y,
+ x,
+ y,
buttons: [
{stepmode: "backward", ...button1},
{stepmode: "backward", ...button2},
@@ -914,8 +914,8 @@ function populate_messages_read_over_time(data) {
values.everyone.push(current.everyone);
values.me.push(current.me);
return {
- dates: dates,
- values: values,
+ dates,
+ values,
last_value_is_partial: !is_boundary(
new Date(start_dates[start_dates.length - 1].getTime() + 60 * 60 * 1000),
),
@@ -1015,13 +1015,13 @@ function populate_messages_read_over_time(data) {
function get_chart_data(data, callback) {
$.get({
url: "/json/analytics/chart_data" + page_params.data_url_suffix,
- data: data,
+ data,
idempotent: true,
- success: function (data) {
+ success(data) {
callback(data);
update_last_full_update(data.end_times);
},
- error: function (xhr) {
+ error(xhr) {
$("#id_stats_errors").show().text(JSON.parse(xhr.responseText).msg);
},
});
diff --git a/static/js/stream_color.js b/static/js/stream_color.js
index f163772edc..0227c7aace 100644
--- a/static/js/stream_color.js
+++ b/static/js/stream_color.js
@@ -63,7 +63,7 @@ const subscriptions_table_colorpicker_options = {
exports.set_colorpicker_color = function (colorpicker, color) {
colorpicker.spectrum({
...subscriptions_table_colorpicker_options,
- color: color,
+ color,
container: "#subscription_overlay .subscription_settings.show",
});
};
diff --git a/static/js/stream_create.js b/static/js/stream_create.js
index f13f38e47f..c625922f3f 100644
--- a/static/js/stream_create.js
+++ b/static/js/stream_create.js
@@ -154,7 +154,7 @@ function create_stream() {
);
return;
}
- data.subscriptions = JSON.stringify([{name: stream_name, description: description}]);
+ data.subscriptions = JSON.stringify([{name: stream_name, description}]);
let invite_only;
let history_public_to_subscribers;
@@ -207,15 +207,15 @@ function create_stream() {
// Subscribe yourself and possible other people to a new stream.
return channel.post({
url: "/json/users/me/subscriptions",
- data: data,
- success: function () {
+ data,
+ success() {
$("#create_stream_name").val("");
$("#create_stream_description").val("");
ui_report.success(i18n.t("Stream successfully created!"), $(".stream_create_info"));
loading.destroy_indicator($("#stream_creating_indicator"));
// The rest of the work is done via the subscribe event we will get
},
- error: function (xhr) {
+ error(xhr) {
const msg = JSON.parse(xhr.responseText).msg;
if (msg.includes("access")) {
// If we can't access the stream, we can safely assume it's
@@ -389,7 +389,7 @@ exports.create_handlers_for_users = function (container) {
const user_id = parseInt(elem.attr("data-user-id"), 10);
const user_checked = filtered_users.has(user_id);
const display = user_checked ? "block" : "none";
- elem.css({display: display});
+ elem.css({display});
});
})();
@@ -425,7 +425,7 @@ exports.set_up_handlers = function () {
if (principals.length >= 50) {
const invites_warning_modal = render_subscription_invites_warning_modal({
- stream_name: stream_name,
+ stream_name,
count: principals.length,
});
$("#stream-creation").append(invites_warning_modal);
diff --git a/static/js/stream_edit.js b/static/js/stream_edit.js
index 11e6a7664d..7f957cd5e7 100644
--- a/static/js/stream_edit.js
+++ b/static/js/stream_edit.js
@@ -197,7 +197,7 @@ exports.invite_user_to_stream = function (user_ids, sub, success, failure) {
subscriptions: JSON.stringify([{name: stream_name}]),
principals: JSON.stringify(user_ids),
},
- success: success,
+ success,
error: failure,
});
};
@@ -231,7 +231,7 @@ function submit_add_subscriber_form(e) {
const already_subscribed_users = Object.keys(data.already_subscribed).join(", ");
stream_subscription_info_elem.text(
i18n.t(" __already_subscribed_users__ are already subscribed.", {
- already_subscribed_users: already_subscribed_users,
+ already_subscribed_users,
}),
);
}
@@ -255,7 +255,7 @@ exports.remove_user_from_stream = function (user_id, sub, success, failure) {
return channel.del({
url: "/json/users/me/subscriptions",
data: {subscriptions: JSON.stringify([stream_name]), principals: JSON.stringify([user_id])},
- success: success,
+ success,
error: failure,
});
};
@@ -298,7 +298,7 @@ function show_subscription_settings(sub_row) {
"'] .pill-container",
);
exports.pill_widget = input_pill.create({
- container: container,
+ container,
create_item_from_text: user_pill.create_item_from_email,
get_text_from_item: user_pill.get_email_from_item,
});
@@ -323,12 +323,12 @@ function show_subscription_settings(sub_row) {
list_render.create(list, users, {
name: "stream_subscribers/" + stream_id,
- modifier: function (item) {
+ modifier(item) {
return format_member_list_elem(item);
},
filter: {
element: $("[data-stream-id='" + stream_id + "'] .search"),
- predicate: function (item, value) {
+ predicate(item, value) {
const person = item;
if (person) {
@@ -391,7 +391,7 @@ exports.show_settings_for = function (node) {
stream_data.update_calculated_fields(sub);
const html = render_subscription_settings({
- sub: sub,
+ sub,
settings: exports.stream_settings(sub),
stream_post_policy_values: stream_data.stream_post_policy_values,
message_retention_text: exports.get_retention_policy_text_for_subscription_type(sub),
@@ -466,8 +466,8 @@ exports.bulk_set_stream_property = function (sub_data, status_element) {
const data = {subscription_data: JSON.stringify(sub_data)};
if (!status_element) {
return channel.post({
- url: url,
- data: data,
+ url,
+ data,
timeout: 10 * 1000,
});
}
@@ -476,7 +476,7 @@ exports.bulk_set_stream_property = function (sub_data, status_element) {
};
exports.set_stream_property = function (sub, property, value, status_element) {
- const sub_data = {stream_id: sub.stream_id, property: property, value: value};
+ const sub_data = {stream_id: sub.stream_id, property, value};
exports.bulk_set_stream_property([sub_data], status_element);
};
@@ -530,13 +530,13 @@ function change_stream_privacy(e) {
channel.patch({
url: "/json/streams/" + stream_id,
- data: data,
- success: function () {
+ data,
+ success() {
overlays.close_modal("#stream_privacy_modal");
$("#stream_privacy_modal").remove();
// The rest will be done by update stream event we will get.
},
- error: function () {
+ error() {
$("#change-stream-privacy-button").text(i18n.t("Try again"));
},
});
@@ -554,14 +554,14 @@ exports.change_stream_name = function (e) {
// Stream names might contain unsafe characters so we must encode it first.
url: "/json/streams/" + stream_id,
data: {new_name: JSON.stringify(new_name)},
- success: function () {
+ success() {
new_name_box.val("");
ui_report.success(
i18n.t("The stream has been renamed!"),
$(".stream_change_property_info"),
);
},
- error: function (xhr) {
+ error(xhr) {
new_name_box.text(stream_data.maybe_get_stream_name(stream_id));
ui_report.error(i18n.t("Error"), xhr, $(".stream_change_property_info"));
},
@@ -598,14 +598,14 @@ exports.change_stream_description = function (e) {
data: {
description: JSON.stringify(description),
},
- success: function () {
+ success() {
// The event from the server will update the rest of the UI
ui_report.success(
i18n.t("The stream description has been updated!"),
$(".stream_change_property_info"),
);
},
- error: function (xhr) {
+ error(xhr) {
sub_settings
.find(".stream-description-editable")
.html(util.clean_user_content_links(sub.rendered_description));
@@ -617,10 +617,10 @@ exports.change_stream_description = function (e) {
exports.delete_stream = function (stream_id, alert_element, stream_row) {
channel.del({
url: "/json/streams/" + stream_id,
- error: function (xhr) {
+ error(xhr) {
ui_report.error(i18n.t("Failed"), xhr, alert_element);
},
- success: function () {
+ success() {
stream_row.remove();
},
});
@@ -643,7 +643,7 @@ exports.initialize = function () {
const stream_id = get_stream_id(e.target);
const stream = stream_data.get_sub_by_id(stream_id);
const template_data = {
- stream_id: stream_id,
+ stream_id,
stream_name: stream.name,
stream_post_policy_values: stream_data.stream_post_policy_values,
stream_post_policy: stream.stream_post_policy,
@@ -775,8 +775,8 @@ exports.initialize = function () {
}
const stream_name = stream_data.maybe_get_stream_name(stream_id);
const deactivate_stream_modal = render_settings_deactivation_stream_modal({
- stream_name: stream_name,
- stream_id: stream_id,
+ stream_name,
+ stream_id,
});
$("#deactivation_stream_modal").remove();
$("#subscriptions_table").append(deactivate_stream_modal);
diff --git a/static/js/stream_events.js b/static/js/stream_events.js
index c76f166fd1..2e67542f80 100644
--- a/static/js/stream_events.js
+++ b/static/js/stream_events.js
@@ -13,9 +13,9 @@ exports.update_property = function (stream_id, property, value, other_values) {
if (sub === undefined) {
// This isn't a stream we know about, so ignore it.
blueslip.warn("Update for an unknown subscription", {
- stream_id: stream_id,
- property: property,
- value: value,
+ stream_id,
+ property,
+ value,
});
return;
}
@@ -62,8 +62,8 @@ exports.update_property = function (stream_id, property, value, other_values) {
break;
default:
blueslip.warn("Unexpected subscription property type", {
- property: property,
- value: value,
+ property,
+ value,
});
}
};
diff --git a/static/js/stream_list.js b/static/js/stream_list.js
index 5830aaada3..da60ad3805 100644
--- a/static/js/stream_list.js
+++ b/static/js/stream_list.js
@@ -219,7 +219,7 @@ exports.set_in_home_view = function (stream_id, in_home) {
function build_stream_sidebar_li(sub) {
const name = sub.name;
const args = {
- name: name,
+ name,
id: sub.stream_id,
uri: hash_util.by_stream_uri(sub.stream_id),
is_muted: stream_data.is_muted(sub.stream_id) === true,
@@ -286,7 +286,7 @@ exports.redraw_stream_privacy = function (sub) {
const args = {
invite_only: sub.invite_only,
- dark_background: dark_background,
+ dark_background,
};
const html = render_stream_privacy(args);
@@ -510,7 +510,7 @@ exports.set_event_handlers = function () {
exports.stream_cursor = list_cursor({
list: {
scroll_container_sel: "#stream-filters-container",
- find_li: function (opts) {
+ find_li(opts) {
const stream_id = opts.key;
const li = exports.get_stream_li(stream_id);
return li;
@@ -527,15 +527,15 @@ exports.set_event_handlers = function () {
keydown_util.handle({
elem: $search_input,
handlers: {
- enter_key: function () {
+ enter_key() {
keydown_enter_key();
return true;
},
- up_arrow: function () {
+ up_arrow() {
exports.stream_cursor.prev();
return true;
},
- down_arrow: function () {
+ down_arrow() {
exports.stream_cursor.next();
return true;
},
diff --git a/static/js/stream_popover.js b/static/js/stream_popover.js
index b2fe4cffdb..1974d006da 100644
--- a/static/js/stream_popover.js
+++ b/static/js/stream_popover.js
@@ -142,7 +142,7 @@ function build_stream_popover(opts) {
});
$(elt).popover({
- content: content,
+ content,
html: true,
trigger: "manual",
fixed: true,
@@ -186,15 +186,15 @@ function build_topic_popover(opts) {
const content = render_topic_sidebar_actions({
stream_name: sub.name,
stream_id: sub.stream_id,
- topic_name: topic_name,
- can_mute_topic: can_mute_topic,
- can_unmute_topic: can_unmute_topic,
+ topic_name,
+ can_mute_topic,
+ can_unmute_topic,
is_admin: sub.is_admin,
color: sub.color,
});
$(elt).popover({
- content: content,
+ content,
html: true,
trigger: "manual",
fixed: true,
@@ -219,7 +219,7 @@ function build_all_messages_popover(e) {
const content = render_all_messages_sidebar_actions();
$(elt).popover({
- content: content,
+ content,
html: true,
trigger: "manual",
fixed: true,
@@ -246,7 +246,7 @@ function build_starred_messages_popover(e) {
});
$(elt).popover({
- content: content,
+ content,
html: true,
trigger: "manual",
fixed: true,
@@ -304,8 +304,8 @@ exports.register_click_handlers = function () {
const stream_id = elem_to_stream_id(stream_li);
build_stream_popover({
- elt: elt,
- stream_id: stream_id,
+ elt,
+ stream_id,
});
});
@@ -318,9 +318,9 @@ exports.register_click_handlers = function () {
const topic_name = $(elt).closest("li").expectOne().attr("data-topic-name");
build_topic_popover({
- elt: elt,
- stream_id: stream_id,
- topic_name: topic_name,
+ elt,
+ stream_id,
+ topic_name,
});
});
@@ -395,7 +395,7 @@ exports.register_stream_handlers = function () {
data.starred_message_counts = JSON.stringify(!starred_msg_counts);
channel.patch({
url: "/json/settings/display",
- data: data,
+ data,
});
});
// Mute/unmute
@@ -610,9 +610,9 @@ exports.register_topic_handlers = function () {
channel.get({
url: "/json/messages",
- data: data,
+ data,
idempotent: true,
- success: function (data) {
+ success(data) {
const message_id = data.messages[0].id;
if (old_topic_name.trim() === new_topic_name.trim()) {
@@ -632,7 +632,7 @@ exports.register_topic_handlers = function () {
$("#move_topic_modal").modal("hide");
}
},
- error: function (xhr) {
+ error(xhr) {
show_error_msg(xhr.responseJSON.msg);
},
});
diff --git a/static/js/stream_sort.js b/static/js/stream_sort.js
index 093c37b7a3..81d042144e 100644
--- a/static/js/stream_sort.js
+++ b/static/js/stream_sort.js
@@ -76,10 +76,10 @@ exports.sort_groups = function (streams, search_term) {
}
return {
- same_as_before: same_as_before,
- pinned_streams: pinned_streams,
- normal_streams: normal_streams,
- dormant_streams: dormant_streams,
+ same_as_before,
+ pinned_streams,
+ normal_streams,
+ dormant_streams,
};
};
diff --git a/static/js/stream_topic_history.js b/static/js/stream_topic_history.js
index faf99160d1..a7aaa419a7 100644
--- a/static/js/stream_topic_history.js
+++ b/static/js/stream_topic_history.js
@@ -98,7 +98,7 @@ exports.per_stream_history = function (stream_id) {
if (!existing) {
topics.set(opts.topic_name, {
- message_id: message_id,
+ message_id,
pretty_name: topic_name,
historical: false,
count: 1,
@@ -162,7 +162,7 @@ exports.per_stream_history = function (stream_id) {
// more current data for it.
topics.set(topic_name, {
- message_id: message_id,
+ message_id,
pretty_name: topic_name,
historical: true,
});
@@ -174,7 +174,7 @@ exports.per_stream_history = function (stream_id) {
const my_recents = Array.from(topics.values());
const missing_topics = unread.get_missing_topics({
- stream_id: stream_id,
+ stream_id,
topic_dict: topics,
});
@@ -230,8 +230,8 @@ exports.add_message = function (opts) {
const history = exports.find_or_create(stream_id);
history.add_or_update({
- topic_name: topic_name,
- message_id: message_id,
+ topic_name,
+ message_id,
});
};
@@ -250,9 +250,9 @@ exports.get_server_history = function (stream_id, on_success) {
const url = "/json/users/me/" + stream_id + "/topics";
channel.get({
- url: url,
+ url,
data: {},
- success: function (data) {
+ success(data) {
const server_history = data.topics;
exports.add_history(stream_id, server_history);
on_success();
diff --git a/static/js/submessage.js b/static/js/submessage.js
index 1ad0abff47..361b9a6a8d 100644
--- a/static/js/submessage.js
+++ b/static/js/submessage.js
@@ -64,12 +64,12 @@ exports.do_process_submessages = function (in_opts) {
const post_to_server = exports.make_server_callback(message_id);
widgetize.activate({
- widget_type: widget_type,
+ widget_type,
extra_data: data.extra_data,
- events: events,
- row: row,
- message: message,
- post_to_server: post_to_server,
+ events,
+ row,
+ message,
+ post_to_server,
});
};
@@ -124,7 +124,7 @@ exports.handle_event = function (submsg) {
widgetize.handle_event({
sender_id: submsg.sender_id,
message_id: submsg.message_id,
- data: data,
+ data,
});
};
@@ -133,9 +133,9 @@ exports.make_server_callback = function (message_id) {
const url = "/json/submessage";
channel.post({
- url: url,
+ url,
data: {
- message_id: message_id,
+ message_id,
msg_type: opts.msg_type,
content: JSON.stringify(opts.data),
},
diff --git a/static/js/subs.js b/static/js/subs.js
index 42a875be02..fab9a0e814 100644
--- a/static/js/subs.js
+++ b/static/js/subs.js
@@ -5,11 +5,11 @@ const render_subscription_table_body = require("../templates/subscription_table_
const render_subscriptions = require("../templates/subscriptions.hbs");
exports.show_subs_pane = {
- nothing_selected: function () {
+ nothing_selected() {
$(".nothing-selected, #stream_settings_title").show();
$("#add_new_stream_title, .settings, #stream-creation").hide();
},
- settings: function () {
+ settings() {
$(".settings, #stream_settings_title").show();
$("#add_new_stream_title, #stream-creation, .nothing-selected").hide();
},
@@ -343,8 +343,8 @@ function triage_stream(query, sub) {
const val = sub[attr];
return search_util.vanilla_match({
- val: val,
- search_terms: search_terms,
+ val,
+ search_terms,
});
}
@@ -468,9 +468,9 @@ exports.get_search_params = function () {
const search_box = $("#stream_filter input[type='text']");
const input = search_box.expectOne().val().trim();
const params = {
- input: input,
- subscribed_only: subscribed_only,
- sort_order: sort_order,
+ input,
+ subscribed_only,
+ sort_order,
};
return params;
};
@@ -561,7 +561,7 @@ exports.setup_page = function (callback) {
},
],
html_class: "stream_sorter_toggle",
- callback: function (value, key) {
+ callback(value, key) {
exports.switch_stream_sort(key);
},
});
@@ -576,7 +576,7 @@ exports.setup_page = function (callback) {
{label: i18n.t("Subscribed"), key: "subscribed"},
{label: i18n.t("All streams"), key: "all-streams"},
],
- callback: function (value, key) {
+ callback(value, key) {
exports.switch_stream_tab(key);
},
});
@@ -702,7 +702,7 @@ exports.launch = function (section) {
overlays.open_overlay({
name: "subscriptions",
overlay: $("#subscription_overlay"),
- on_close: function () {
+ on_close() {
hashchange.exit_overlay();
},
});
@@ -817,8 +817,8 @@ function ajaxSubscribe(stream, color, stream_row) {
}
return channel.post({
url: "/json/users/me/subscriptions",
- data: {subscriptions: JSON.stringify([{name: stream, color: color}])},
- success: function (resp, statusText, xhr) {
+ data: {subscriptions: JSON.stringify([{name: stream, color}])},
+ success(resp, statusText, xhr) {
if (overlays.streams_open()) {
$("#create_stream_name").val("");
}
@@ -838,7 +838,7 @@ function ajaxSubscribe(stream, color, stream_row) {
hide_subscribe_toggle_spinner(stream_row);
}
},
- error: function (xhr) {
+ error(xhr) {
if (stream_row !== undefined) {
hide_subscribe_toggle_spinner(stream_row);
}
@@ -859,7 +859,7 @@ function ajaxUnsubscribe(sub, stream_row) {
return channel.del({
url: "/json/users/me/subscriptions",
data: {subscriptions: JSON.stringify([sub.name])},
- success: function () {
+ success() {
$(".stream_change_property_info").hide();
// The rest of the work is done via the unsubscribe event we will get
@@ -867,7 +867,7 @@ function ajaxUnsubscribe(sub, stream_row) {
hide_subscribe_toggle_spinner(stream_row);
}
},
- error: function (xhr) {
+ error(xhr) {
if (stream_row !== undefined) {
hide_subscribe_toggle_spinner(stream_row);
}
diff --git a/static/js/templates.js b/static/js/templates.js
index 38e25e6456..a93fc79e7f 100644
--- a/static/js/templates.js
+++ b/static/js/templates.js
@@ -15,10 +15,10 @@ const util = require("./util");
Handlebars.registerHelper("plural", (condition, one, other) => (condition === 1 ? one : other));
Handlebars.registerHelper({
- eq: function (a, b) {
+ eq(a, b) {
return a === b;
},
- and: function (...args) {
+ and(...args) {
args.pop(); // Handlebars options
if (args.length === 0) {
return true;
@@ -31,7 +31,7 @@ Handlebars.registerHelper({
}
return last;
},
- or: function (...args) {
+ or(...args) {
args.pop(); // Handlebars options
if (args.length === 0) {
return false;
@@ -44,7 +44,7 @@ Handlebars.registerHelper({
}
return last;
},
- not: function (a) {
+ not(a) {
return !a || Handlebars.Utils.isEmpty(a);
},
});
diff --git a/static/js/tictactoe_widget.js b/static/js/tictactoe_widget.js
index 021393e1cc..26d96bb09e 100644
--- a/static/js/tictactoe_widget.js
+++ b/static/js/tictactoe_widget.js
@@ -62,8 +62,8 @@ const tictactoe_data_holder = function () {
}
const widget_data = {
- squares: squares,
- move_status: move_status,
+ squares,
+ move_status,
};
return widget_data;
@@ -71,16 +71,16 @@ const tictactoe_data_holder = function () {
self.handle = {
square_click: {
- outbound: function (idx) {
+ outbound(idx) {
const event = {
type: "square_click",
- idx: idx,
- num_filled: num_filled,
+ idx,
+ num_filled,
};
return event;
},
- inbound: function (sender_id, data) {
+ inbound(sender_id, data) {
const idx = data.idx;
if (data.num_filled !== num_filled) {
diff --git a/static/js/timerender.js b/static/js/timerender.js
index 1bf1ffcdb5..74fffaddb2 100644
--- a/static/js/timerender.js
+++ b/static/js/timerender.js
@@ -51,9 +51,9 @@ exports.render_now = function (time, today) {
needs_update = false;
}
return {
- time_str: time_str,
- formal_time_str: formal_time_str,
- needs_update: needs_update,
+ time_str,
+ formal_time_str,
+ needs_update,
};
};
@@ -68,7 +68,7 @@ exports.last_seen_status_from_date = function (last_active_date, current_date) {
return i18n.t("Just now");
}
if (minutes < 60) {
- return i18n.t("__minutes__ minutes ago", {minutes: minutes});
+ return i18n.t("__minutes__ minutes ago", {minutes});
}
const hours = Math.floor(minutes / 60);
@@ -76,7 +76,7 @@ exports.last_seen_status_from_date = function (last_active_date, current_date) {
return i18n.t("An hour ago");
}
if (hours < 24) {
- return i18n.t("__hours__ hours ago", {hours: hours});
+ return i18n.t("__hours__ hours ago", {hours});
}
const days = Math.floor(hours / 24);
@@ -85,7 +85,7 @@ exports.last_seen_status_from_date = function (last_active_date, current_date) {
}
if (days < 90) {
- return i18n.t("__days__ days ago", {days: days});
+ return i18n.t("__days__ days ago", {days});
} else if (days > 90 && days < 365) {
if (current_date.getFullYear() === last_active_date.getFullYear()) {
// Online more than 90 days ago, in the same year
@@ -158,9 +158,9 @@ exports.render_date = function (time, time_above, today) {
}
maybe_add_update_list_entry({
needs_update: rendered_time.needs_update,
- className: className,
- time: time,
- time_above: time_above,
+ className,
+ time,
+ time_above,
});
return node;
};
@@ -203,9 +203,9 @@ exports.update_timestamps = function () {
}
maybe_add_update_list_entry({
needs_update: rendered_time.needs_update,
- className: className,
- time: time,
- time_above: time_above,
+ className,
+ time,
+ time_above,
});
}
}
diff --git a/static/js/todo_widget.js b/static/js/todo_widget.js
index b4349b52a6..a7c0eeeac1 100644
--- a/static/js/todo_widget.js
+++ b/static/js/todo_widget.js
@@ -32,8 +32,8 @@ exports.task_data_holder = function () {
}
const widget_data = {
- pending_tasks: pending_tasks,
- completed_tasks: completed_tasks,
+ pending_tasks,
+ completed_tasks,
};
return widget_data;
@@ -51,12 +51,12 @@ exports.task_data_holder = function () {
self.handle = {
new_task: {
- outbound: function (task, desc) {
+ outbound(task, desc) {
const event = {
type: "new_task",
key: get_new_index(),
- task: task,
- desc: desc,
+ task,
+ desc,
completed: false,
};
@@ -66,7 +66,7 @@ exports.task_data_holder = function () {
return;
},
- inbound: function (sender_id, data) {
+ inbound(sender_id, data) {
// for legacy reasons, the inbound idx is
// called key in the event
const idx = data.key;
@@ -76,11 +76,11 @@ exports.task_data_holder = function () {
const completed = data.completed;
const task_data = {
- task: task,
- desc: desc,
- idx: idx,
- key: key,
- completed: completed,
+ task,
+ desc,
+ idx,
+ key,
+ completed,
};
if (!self.name_in_use(task)) {
@@ -90,16 +90,16 @@ exports.task_data_holder = function () {
},
strike: {
- outbound: function (key) {
+ outbound(key) {
const event = {
type: "strike",
- key: key,
+ key,
};
return event;
},
- inbound: function (sender_id, data) {
+ inbound(sender_id, data) {
const key = data.key;
const item = task_map.get(key);
diff --git a/static/js/topic_generator.js b/static/js/topic_generator.js
index 81a2b21685..0685710686 100644
--- a/static/js/topic_generator.js
+++ b/static/js/topic_generator.js
@@ -4,7 +4,7 @@ exports.sub_list_generator = function (lst, lower, upper) {
let i = lower;
return {
- next: function () {
+ next() {
if (i >= upper) {
return;
}
@@ -21,7 +21,7 @@ exports.reverse_sub_list_generator = function (lst, lower, upper) {
let i = upper - 1;
return {
- next: function () {
+ next() {
if (i < lower) {
return;
}
@@ -45,7 +45,7 @@ exports.fchain = function (outer_gen, get_inner_gen) {
let inner_gen;
return {
- next: function () {
+ next() {
while (outer_val !== undefined) {
if (inner_gen === undefined) {
inner_gen = get_inner_gen(outer_val);
@@ -131,7 +131,7 @@ exports.reverse_wrap_exclude = function (lst, val) {
exports.filter = function (gen, filter_func) {
return {
- next: function () {
+ next() {
while (true) {
const val = gen.next();
if (val === undefined) {
@@ -147,7 +147,7 @@ exports.filter = function (gen, filter_func) {
exports.map = function (gen, map_func) {
return {
- next: function () {
+ next() {
const val = gen.next();
if (val === undefined) {
return;
@@ -176,7 +176,7 @@ exports.next_topic = function (streams, get_topics, has_unread_messages, curr_st
function make_object(topic) {
return {
stream: which_stream,
- topic: topic,
+ topic,
};
}
diff --git a/static/js/topic_list.js b/static/js/topic_list.js
index dfbc2f2710..f94aea79e1 100644
--- a/static/js/topic_list.js
+++ b/static/js/topic_list.js
@@ -62,17 +62,17 @@ exports.keyed_topic_li = (convo) => {
const key = "t:" + convo.topic_name;
return {
- key: key,
- render: render,
- convo: convo,
- eq: eq,
+ key,
+ render,
+ convo,
+ eq,
};
};
exports.more_li = (more_topics_unreads) => {
const render = () =>
render_more_topics({
- more_topics_unreads: more_topics_unreads,
+ more_topics_unreads,
});
const eq = (other) => other.more_items && more_topics_unreads === other.more_topics_unreads;
@@ -80,11 +80,11 @@ exports.more_li = (more_topics_unreads) => {
const key = "more";
return {
- key: key,
+ key,
more_items: true,
- more_topics_unreads: more_topics_unreads,
- render: render,
- eq: eq,
+ more_topics_unreads,
+ render,
+ eq,
};
};
@@ -96,10 +96,10 @@ exports.spinner_li = () => {
const key = "more";
return {
- key: key,
+ key,
spinner: true,
- render: render,
- eq: eq,
+ render,
+ eq,
};
};
@@ -129,7 +129,7 @@ exports.widget = function (parent_elem, my_stream_id) {
}
const dom = vdom.ul({
- attrs: attrs,
+ attrs,
keyed_nodes: nodes,
});
diff --git a/static/js/topic_list_data.js b/static/js/topic_list_data.js
index b414214832..5d35a3649d 100644
--- a/static/js/topic_list_data.js
+++ b/static/js/topic_list_data.js
@@ -78,11 +78,11 @@ exports.get_list_info = function (stream_id, zoomed) {
}
const topic_info = {
- topic_name: topic_name,
+ topic_name,
unread: num_unread,
is_zero: num_unread === 0,
is_muted: is_topic_muted,
- is_active_topic: is_active_topic,
+ is_active_topic,
url: hash_util.by_stream_topic_uri(stream_id, topic_name),
};
@@ -90,8 +90,8 @@ exports.get_list_info = function (stream_id, zoomed) {
}
return {
- items: items,
+ items,
num_possible_topics: topic_names.length,
- more_topics_unreads: more_topics_unreads,
+ more_topics_unreads,
};
};
diff --git a/static/js/topic_zoom.js b/static/js/topic_zoom.js
index 0217d0c60e..0f55534aa7 100644
--- a/static/js/topic_zoom.js
+++ b/static/js/topic_zoom.js
@@ -10,7 +10,7 @@ function zoom_in() {
popovers.hide_all_except_sidebars();
topic_list.zoom_in();
stream_list.zoom_in_topics({
- stream_id: stream_id,
+ stream_id,
});
zoomed_in = true;
diff --git a/static/js/transmit.js b/static/js/transmit.js
index bebecf3e6d..31cbafceae 100644
--- a/static/js/transmit.js
+++ b/static/js/transmit.js
@@ -10,7 +10,7 @@ exports.send_message = function (request, on_success, error) {
// Once everything is done, get ready to report times to the server.
sent_messages.report_server_ack(request.local_id);
},
- error: function (xhr, error_type) {
+ error(xhr, error_type) {
if (error_type !== "timeout" && reload_state.is_pending()) {
// The error might be due to the server changing
reload.initiate({
@@ -60,12 +60,12 @@ exports.reply_message = function (opts) {
const reply = {
sender_id: page_params.user_id,
queue_id: page_params.queue_id,
- local_id: local_id,
+ local_id,
};
sent_messages.start_tracking_message({
- local_id: local_id,
- locally_echoed: locally_echoed,
+ local_id,
+ locally_echoed,
});
if (message.type === "stream") {
diff --git a/static/js/typing.js b/static/js/typing.js
index d4bf913d4c..60f3bb8bf9 100644
--- a/static/js/typing.js
+++ b/static/js/typing.js
@@ -13,8 +13,8 @@ function send_typing_notification_ajax(user_ids_array, operation) {
to: JSON.stringify(user_ids_array),
op: operation,
},
- success: function () {},
- error: function (xhr) {
+ success() {},
+ error(xhr) {
blueslip.warn("Failed to send typing event: " + xhr.responseText);
},
});
@@ -53,9 +53,9 @@ function notify_server_stop(user_ids_array) {
exports.get_recipient = get_user_ids_array;
exports.initialize = function () {
const worker = {
- get_current_time: get_current_time,
- notify_server_start: notify_server_start,
- notify_server_stop: notify_server_stop,
+ get_current_time,
+ notify_server_start,
+ notify_server_stop,
};
$(document).on("input", "#compose-textarea", () => {
diff --git a/static/js/ui.js b/static/js/ui.js
index 43c68a1280..3368cbfab5 100644
--- a/static/js/ui.js
+++ b/static/js/ui.js
@@ -147,7 +147,7 @@ exports.get_hotkey_deprecation_notice = function (originalHotkey, replacementHot
return i18n.t(
'We\'ve replaced the "__originalHotkey__" hotkey with "__replacementHotkey__" ' +
"to make this common shortcut easier to trigger.",
- {originalHotkey: originalHotkey, replacementHotkey: replacementHotkey},
+ {originalHotkey, replacementHotkey},
);
};
diff --git a/static/js/unread.js b/static/js/unread.js
index 223d2b016d..8c7cb2e5cd 100644
--- a/static/js/unread.js
+++ b/static/js/unread.js
@@ -133,8 +133,8 @@ exports.unread_pm_counter = (function () {
total_count += count;
}
return {
- total_count: total_count,
- pm_dict: pm_dict,
+ total_count,
+ pm_dict,
};
};
@@ -216,7 +216,7 @@ exports.unread_topic_counter = (function () {
bucketer.add({
bucket_key: stream_id,
item_id: msg_id,
- add_callback: function (per_stream_bucketer) {
+ add_callback(per_stream_bucketer) {
per_stream_bucketer.add({
bucket_key: topic,
item_id: msg_id,
diff --git a/static/js/unread_ops.js b/static/js/unread_ops.js
index d1ddd90d56..d2e7d116fc 100644
--- a/static/js/unread_ops.js
+++ b/static/js/unread_ops.js
@@ -109,7 +109,7 @@ exports.mark_stream_as_read = function (stream_id, cont) {
channel.post({
url: "/json/mark_stream_as_read",
idempotent: true,
- data: {stream_id: stream_id},
+ data: {stream_id},
success: cont,
});
};
@@ -118,7 +118,7 @@ exports.mark_topic_as_read = function (stream_id, topic, cont) {
channel.post({
url: "/json/mark_topic_as_read",
idempotent: true,
- data: {stream_id: stream_id, topic_name: topic},
+ data: {stream_id, topic_name: topic},
success: cont,
});
};
diff --git a/static/js/upload_widget.js b/static/js/upload_widget.js
index 921e749cdf..b4f26beaaa 100644
--- a/static/js/upload_widget.js
+++ b/static/js/upload_widget.js
@@ -103,10 +103,10 @@ exports.build_widget = function (
return {
// Call back to clear() in situations like adding bots, when
// we want to use the same widget over and over again.
- clear: clear,
+ clear,
// Call back to close() when you are truly done with the widget,
// so you can release handlers.
- close: close,
+ close,
};
};
exports.build_direct_upload_widget = function (
diff --git a/static/js/user_pill.js b/static/js/user_pill.js
index 405f9458c1..e9f5265200 100644
--- a/static/js/user_pill.js
+++ b/static/js/user_pill.js
@@ -19,7 +19,7 @@ exports.create_item_from_email = function (email, current_items) {
// is the email itself.
return {
display_value: email,
- email: email,
+ email,
};
}
@@ -125,11 +125,11 @@ exports.set_up_typeahead_on_pills = function (input, pills, update_func, source)
items: 5,
fixed: true,
dropup: true,
- source: source,
- highlighter: function (item) {
+ source,
+ highlighter(item) {
return typeahead_helper.render_person(item);
},
- matcher: function (item) {
+ matcher(item) {
let query = this.query.toLowerCase();
query = query.replace(/\u00A0/g, String.fromCharCode(32));
if (!settings_data.show_email()) {
@@ -140,10 +140,10 @@ exports.set_up_typeahead_on_pills = function (input, pills, update_func, source)
email.toLowerCase().includes(query) || item.full_name.toLowerCase().includes(query)
);
},
- sorter: function (matches) {
+ sorter(matches) {
return typeahead_helper.sort_recipientbox_typeahead(this.query, matches, "");
},
- updater: function (user) {
+ updater(user) {
exports.append_user(user, pills);
input.trigger("focus");
update_func();
diff --git a/static/js/user_status.js b/static/js/user_status.js
index 9daa276e1c..930d71f7d0 100644
--- a/static/js/user_status.js
+++ b/static/js/user_status.js
@@ -9,7 +9,7 @@ exports.server_update = function (opts) {
status_text: opts.status_text,
},
idempotent: true,
- success: function () {
+ success() {
if (opts.success) {
opts.success();
}
diff --git a/static/js/user_status_ui.js b/static/js/user_status_ui.js
index 1f060c0a7b..60a10e81b0 100644
--- a/static/js/user_status_ui.js
+++ b/static/js/user_status_ui.js
@@ -10,8 +10,8 @@ exports.open_overlay = function () {
const overlay = $(".user_status_overlay");
overlays.open_overlay({
name: "user_status_overlay",
- overlay: overlay,
- on_close: function () {},
+ overlay,
+ on_close() {},
});
const user_id = people.my_current_user_id();
@@ -43,7 +43,7 @@ exports.submit_new_status = function () {
user_status.server_update({
status_text: new_status_text,
- success: function () {
+ success() {
exports.close_overlay();
},
});
diff --git a/static/js/vdom.js b/static/js/vdom.js
index 3e550b0e6b..edf523dd0b 100644
--- a/static/js/vdom.js
+++ b/static/js/vdom.js
@@ -18,7 +18,7 @@ exports.eq_array = (a, b, eq) => {
exports.ul = (opts) => ({
tag_name: "ul",
- opts: opts,
+ opts,
});
exports.render_tag = (tag) => {
diff --git a/static/js/widgetize.js b/static/js/widgetize.js
index f147f8deed..5ff0346fdd 100644
--- a/static/js/widgetize.js
+++ b/static/js/widgetize.js
@@ -31,7 +31,7 @@ exports.activate = function (in_opts) {
const callback = function (data) {
post_to_server({
msg_type: "widget",
- data: data,
+ data,
});
};
@@ -53,9 +53,9 @@ exports.activate = function (in_opts) {
widgets.get(widget_type).activate({
elem: widget_elem,
- callback: callback,
- message: message,
- extra_data: extra_data,
+ callback,
+ message,
+ extra_data,
});
widget_contents.set(message.id, widget_elem);
diff --git a/static/js/zcommand.js b/static/js/zcommand.js
index 9a15c39b2d..b5ddee8fb8 100644
--- a/static/js/zcommand.js
+++ b/static/js/zcommand.js
@@ -20,18 +20,18 @@ exports.send = function (opts) {
const command = opts.command;
const on_success = opts.on_success;
const data = {
- command: command,
+ command,
};
channel.post({
url: "/json/zcommand",
- data: data,
- success: function (data) {
+ data,
+ success(data) {
if (on_success) {
on_success(data);
}
},
- error: function () {
+ error() {
exports.tell_user("server did not respond");
},
});
@@ -51,14 +51,14 @@ exports.tell_user = function (msg) {
exports.enter_day_mode = function () {
exports.send({
command: "/day",
- on_success: function (data) {
+ on_success(data) {
night_mode.disable();
feedback_widget.show({
- populate: function (container) {
+ populate(container) {
const rendered_msg = marked(data.msg).trim();
container.html(rendered_msg);
},
- on_undo: function () {
+ on_undo() {
exports.send({
command: "/night",
});
@@ -73,14 +73,14 @@ exports.enter_day_mode = function () {
exports.enter_night_mode = function () {
exports.send({
command: "/night",
- on_success: function (data) {
+ on_success(data) {
night_mode.enable();
feedback_widget.show({
- populate: function (container) {
+ populate(container) {
const rendered_msg = marked(data.msg).trim();
container.html(rendered_msg);
},
- on_undo: function () {
+ on_undo() {
exports.send({
command: "/day",
});
@@ -95,14 +95,14 @@ exports.enter_night_mode = function () {
exports.enter_fluid_mode = function () {
exports.send({
command: "/fluid-width",
- on_success: function (data) {
+ on_success(data) {
scroll_bar.set_layout_width();
feedback_widget.show({
- populate: function (container) {
+ populate(container) {
const rendered_msg = marked(data.msg).trim();
container.html(rendered_msg);
},
- on_undo: function () {
+ on_undo() {
exports.send({
command: "/fixed-width",
});
@@ -117,14 +117,14 @@ exports.enter_fluid_mode = function () {
exports.enter_fixed_mode = function () {
exports.send({
command: "/fixed-width",
- on_success: function (data) {
+ on_success(data) {
scroll_bar.set_layout_width();
feedback_widget.show({
- populate: function (container) {
+ populate(container) {
const rendered_msg = marked(data.msg).trim();
container.html(rendered_msg);
},
- on_undo: function () {
+ on_undo() {
exports.send({
command: "/fluid-width",
});
@@ -144,7 +144,7 @@ exports.process = function (message_content) {
exports.send({
command: content,
- on_success: function () {
+ on_success() {
const end_time = new Date();
let diff = end_time - start_time;
diff = Math.round(diff);
diff --git a/tools/message-screenshot.js b/tools/message-screenshot.js
index 7734b8677d..e5211a144a 100644
--- a/tools/message-screenshot.js
+++ b/tools/message-screenshot.js
@@ -65,7 +65,7 @@ async function run() {
const imagePath = options.imagePath;
const imageDir = path.dirname(imagePath);
mkdirp.sync(imageDir);
- await page.screenshot({path: imagePath, clip: clip});
+ await page.screenshot({path: imagePath, clip});
} catch (e) {
console.log(e);
process.exit(1);
diff --git a/zerver/openapi/javascript_examples.js b/zerver/openapi/javascript_examples.js
index 000a24e471..faf1106c85 100644
--- a/zerver/openapi/javascript_examples.js
+++ b/zerver/openapi/javascript_examples.js
@@ -338,7 +338,7 @@ add_example("update_message", "/messages/{message_id}:patch", 200, async (client
// {code_example|start}
// Update a message with the given "message_id"
const params = {
- message_id: message_id,
+ message_id,
content: "New Content",
};
@@ -360,7 +360,7 @@ add_example("get_events", "/events:get", 200, async (client) => {
// {code_example|start}
// Retrieve events from a queue with given "queue_id"
const eventParams = {
- queue_id: queue_id,
+ queue_id,
last_event_id: -1,
};