Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
eslint: Fix unicorn/logical-assignment-operators.
Anders Kaseorg44c732a9bc11
diff --git a/web/src/flatpickr.ts b/web/src/flatpickr.tsindex 0c339b73d90..42a062087b1 100644--- a/web/src/flatpickr.ts+++ b/web/src/flatpickr.ts@@ -29,7 +29,7 @@ export function show_flatpickr(): flatpickr.Instance {const $flatpickr_input = $<HTMLInputElement>("<input>").attr("id", "#timestamp_flatpickr");- options.enableTime = options.enableTime ?? ENABLE_TIME_DEFAULT;+ options.enableTime ??= ENABLE_TIME_DEFAULT;if (hide_confirm_button && options.enableTime) {throw new Error("`hide_confirm_button` is only supported for date-only flatpickr (set `enableTime` to false).",diff --git a/web/src/inbox_ui.ts b/web/src/inbox_ui.tsindex c31dff6934f..364ab54b698 100644--- a/web/src/inbox_ui.ts+++ b/web/src/inbox_ui.ts@@ -934,10 +934,8 @@ function update_channel_folder_data(channel_context: StreamContext): void {} else {folder_context.unread_count =(folder_context.unread_count ?? 0) + (channel_context.unread_count ?? 0);- folder_context.is_header_visible =- folder_context.is_header_visible || !channel_context.is_hidden;- folder_context.has_unread_mention =- folder_context.has_unread_mention || channel_context.mention_in_unread;+ folder_context.is_header_visible ||= !channel_context.is_hidden;+ folder_context.has_unread_mention ||= channel_context.mention_in_unread;}}diff --git a/web/src/message_fetch.ts b/web/src/message_fetch.tsindex 8e7bc542abe..27aad499862 100644--- a/web/src/message_fetch.ts+++ b/web/src/message_fetch.ts@@ -427,7 +427,7 @@ export function load_messages(opts: MessageFetchOptions, attempt = 1): void {if (opts.num_after > 0) {// 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;+ update_loading_indicator &&= opts.num_before === 0;opts.msg_list_data.fetch_status.start_newer_batch({update_loading_indicator,});diff --git a/web/src/pill_typeahead.ts b/web/src/pill_typeahead.tsindex 87ed22741c4..1bf5d5e6c58 100644--- a/web/src/pill_typeahead.ts+++ b/web/src/pill_typeahead.ts@@ -217,11 +217,11 @@ export function set_up_group_setting_typeahead(return (item: GroupSettingTypeaheadItem): boolean => {let matches = false;if (item.type === "user_group") {- matches = matches || group_matcher(query, item, should_remove_diacritics);+ matches ||= group_matcher(query, item, should_remove_diacritics);}if (item.type === "user") {- matches = matches || person_matcher(query, item, should_remove_diacritics);+ matches ||= person_matcher(query, item, should_remove_diacritics);}return matches;};@@ -381,7 +381,7 @@ export function set_up_combined(}if (include_users && item.type === "user") {- matches = matches || person_matcher(query, item, should_remove_diacritics);+ matches ||= person_matcher(query, item, should_remove_diacritics);}return matches;};diff --git a/web/src/portico/legacy_landing_page.ts b/web/src/portico/legacy_landing_page.tsindex 0da97c4f17d..c0eafeceff2 100644--- a/web/src/portico/legacy_landing_page.ts+++ b/web/src/portico/legacy_landing_page.ts@@ -174,7 +174,7 @@ const apps_events = function (): void {}}- result = result ?? detect_user_os();+ result ??= detect_user_os();return result;}diff --git a/web/src/recent_view_ui.ts b/web/src/recent_view_ui.tsindex a132681f09f..7ceac9c872f 100644--- a/web/src/recent_view_ui.ts+++ b/web/src/recent_view_ui.ts@@ -976,7 +976,7 @@ export function process_topic_edit(const old_topic_msgs = message_util.get_loaded_messages_in_topic(old_stream_id, old_topic);- new_stream_id = new_stream_id || old_stream_id;+ new_stream_id ||= old_stream_id;const new_topic_msgs = message_util.get_loaded_messages_in_topic(new_stream_id, new_topic);for (const msg of [...old_topic_msgs, ...new_topic_msgs]) {diff --git a/web/tests/filter.test.cjs b/web/tests/filter.test.cjsindex b65fb8b5a6b..3e6d50864bb 100644--- a/web/tests/filter.test.cjs+++ b/web/tests/filter.test.cjs@@ -747,7 +747,7 @@ test("basics", () => {});function assert_not_mark_read_with_has_operands(additional_terms_to_test) {- additional_terms_to_test = additional_terms_to_test || [];+ additional_terms_to_test ||= [];let has_link_term = [{operator: "has", operand: "link"}];let filter = new Filter([...additional_terms_to_test, ...has_link_term]);assert.ok(!filter.can_mark_messages_read());@@ -777,7 +777,7 @@ function assert_not_mark_read_with_has_operands(additional_terms_to_test) {assert.ok(!filter.can_mark_messages_read());}function assert_not_mark_read_with_is_operands(additional_terms_to_test) {- additional_terms_to_test = additional_terms_to_test || [];+ additional_terms_to_test ||= [];let is_operator = [{operator: "is", operand: "starred"}];let filter = new Filter([...additional_terms_to_test, ...is_operator]);assert.ok(!filter.can_mark_messages_read());@@ -828,7 +828,7 @@ function assert_not_mark_read_with_is_operands(additional_terms_to_test) {}function assert_not_mark_read_when_searching(additional_terms_to_test) {- additional_terms_to_test = additional_terms_to_test || [];+ additional_terms_to_test ||= [];let search_op = [{operator: "search", operand: "keyword"}];let filter = new Filter([...additional_terms_to_test, ...search_op]);assert.ok(!filter.can_mark_messages_read());diff --git a/web/tests/lib/markdown_assert.cjs b/web/tests/lib/markdown_assert.cjsindex 37337ca9468..17127d019af 100644--- a/web/tests/lib/markdown_assert.cjs+++ b/web/tests/lib/markdown_assert.cjs@@ -139,7 +139,7 @@ class MarkdownComparer {assertEqual(actual, expected, message) {const comparison_results = this._compare(actual, expected);- message = message || "";+ message ||= "";message += "\n";/* istanbul ignore if */@@ -158,7 +158,7 @@ class MarkdownComparer {assertNotEqual(actual, expected, message) {const comparison_results = this._compare(actual, expected);- message = message || "";+ message ||= "";message += "\n";/* istanbul ignore if */