mirror of https://github.com/zulip/zulip.git
eslint: Fix unicorn/prefer-spread.
This was initially disabled for IE/Babel-related reasons that no longer apply. Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
941a9bab38
commit
2a70c11c5f
|
@ -116,7 +116,6 @@
|
|||
"unicorn/numeric-separators-style": "off",
|
||||
"unicorn/prefer-module": "off",
|
||||
"unicorn/prefer-node-protocol": "off",
|
||||
"unicorn/prefer-spread": "off",
|
||||
"unicorn/prefer-ternary": "off",
|
||||
"unicorn/prefer-top-level-await": "off",
|
||||
"unicorn/prevent-abbreviations": "off",
|
||||
|
|
|
@ -65,7 +65,7 @@ export class PollData {
|
|||
const options = [];
|
||||
|
||||
for (const [key, obj] of this.key_to_option) {
|
||||
const voters = Array.from(obj.votes.keys());
|
||||
const voters = [...obj.votes.keys()];
|
||||
const current_user_vote = voters.includes(this.me);
|
||||
|
||||
options.push({
|
||||
|
|
|
@ -147,7 +147,7 @@ export function triage<T>(
|
|||
}
|
||||
}
|
||||
return {
|
||||
matches: exactMatch.concat(beginswithCaseSensitive.concat(beginswithCaseInsensitive)),
|
||||
matches: [...exactMatch, ...beginswithCaseSensitive, ...beginswithCaseInsensitive],
|
||||
rest: noMatch,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ const services = new Map();
|
|||
const services_fields = ["base_url", "interface", "config_data", "service_name", "token"];
|
||||
|
||||
export function all_user_ids() {
|
||||
return Array.from(bots.keys());
|
||||
return [...bots.keys()];
|
||||
}
|
||||
|
||||
export function add(bot) {
|
||||
|
|
|
@ -292,7 +292,7 @@ function filter_user_ids(user_filter_text, user_ids) {
|
|||
|
||||
const user_id_dict = people.filter_people_by_search_terms(persons, search_terms);
|
||||
|
||||
return Array.from(user_id_dict.keys());
|
||||
return [...user_id_dict.keys()];
|
||||
}
|
||||
|
||||
function get_filtered_user_id_list(user_filter_text) {
|
||||
|
|
|
@ -35,7 +35,7 @@ const stream_colors = [
|
|||
export const colors = _.shuffle(stream_colors);
|
||||
|
||||
export function reset(): void {
|
||||
unused_colors = colors.slice();
|
||||
unused_colors = [...colors];
|
||||
}
|
||||
|
||||
reset();
|
||||
|
|
|
@ -141,7 +141,7 @@ export function warn_if_mentioning_unsubscribed_user(mentioned) {
|
|||
`#compose_banners .${compose_banner.CLASSNAMES.recipient_not_subscribed}`,
|
||||
);
|
||||
|
||||
const existing_invites = Array.from($existing_invites_area, (user_row) =>
|
||||
const existing_invites = [...$existing_invites_area].map((user_row) =>
|
||||
Number.parseInt($(user_row).data("user-id"), 10),
|
||||
);
|
||||
|
||||
|
|
|
@ -466,7 +466,7 @@ export function get_person_suggestions(query, opts) {
|
|||
persons = muted_users.filter_muted_users(persons);
|
||||
|
||||
if (opts.want_broadcast) {
|
||||
persons = persons.concat(broadcast_mentions());
|
||||
persons = [...persons, ...broadcast_mentions()];
|
||||
}
|
||||
|
||||
return persons.filter((item) => query_matches_person(query, item));
|
||||
|
|
|
@ -641,7 +641,7 @@ export function launch() {
|
|||
$("#draft_overlay").css("opacity");
|
||||
|
||||
open_overlay();
|
||||
set_initial_element(formatted_narrow_drafts.concat(formatted_other_drafts));
|
||||
set_initial_element([...formatted_narrow_drafts, ...formatted_other_drafts]);
|
||||
setup_event_handlers();
|
||||
}
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ export function rebuild_catalog() {
|
|||
const catalog = new Map();
|
||||
catalog.set(
|
||||
"Custom",
|
||||
Array.from(realm_emojis.keys(), (realm_emoji_name) =>
|
||||
[...realm_emojis.keys()].map((realm_emoji_name) =>
|
||||
emoji.emojis_by_name.get(realm_emoji_name),
|
||||
),
|
||||
);
|
||||
|
|
|
@ -947,7 +947,7 @@ export class Filter {
|
|||
return util.strcmp(a, b);
|
||||
};
|
||||
|
||||
return term_types.slice().sort(compare);
|
||||
return [...term_types].sort(compare);
|
||||
}
|
||||
|
||||
static operator_to_prefix(operator, negated) {
|
||||
|
@ -1060,7 +1060,7 @@ export class Filter {
|
|||
}
|
||||
return "unknown operator";
|
||||
});
|
||||
return parts.concat(more_parts).join(", ");
|
||||
return [...parts, ...more_parts].join(", ");
|
||||
}
|
||||
|
||||
static describe(operators) {
|
||||
|
|
|
@ -160,7 +160,7 @@ export function group_edit_url(group) {
|
|||
|
||||
export function search_public_streams_notice_url(operators) {
|
||||
const public_operator = {operator: "streams", operand: "public"};
|
||||
return operators_to_hash([public_operator].concat(operators));
|
||||
return operators_to_hash([public_operator, ...operators]);
|
||||
}
|
||||
|
||||
export function parse_narrow(hash) {
|
||||
|
|
|
@ -252,7 +252,7 @@ export function close_hotspot_icon(elem) {
|
|||
|
||||
function close_read_hotspots(new_hotspots) {
|
||||
const unwanted_hotspots = _.difference(
|
||||
Array.from(HOTSPOT_LOCATIONS.keys()),
|
||||
[...HOTSPOT_LOCATIONS.keys()],
|
||||
new_hotspots.map((hotspot) => hotspot.name),
|
||||
);
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ export function process_loaded_messages(messages) {
|
|||
}
|
||||
|
||||
export function get_huddles() {
|
||||
let huddles = Array.from(huddle_timestamps.keys());
|
||||
let huddles = [...huddle_timestamps.keys()];
|
||||
huddles = _.sortBy(huddles, (huddle) => huddle_timestamps.get(huddle));
|
||||
return huddles.reverse();
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ export class LazySet {
|
|||
}
|
||||
|
||||
map<T>(f: (v: number, k: number) => T): T[] {
|
||||
return Array.from(this.keys(), f);
|
||||
return [...this.keys()].map((v, k) => f(v, k));
|
||||
}
|
||||
|
||||
has(v: number): boolean {
|
||||
|
|
|
@ -33,7 +33,7 @@ function python_to_js_linkifier(pattern, url) {
|
|||
// JS regexes only support i (case insensitivity) and m (multiline)
|
||||
// flags, so keep those and ignore the rest
|
||||
if (match) {
|
||||
const py_flags = match[1].split("");
|
||||
const py_flags = match[1];
|
||||
|
||||
for (const flag of py_flags) {
|
||||
if ("im".includes(flag)) {
|
||||
|
|
|
@ -486,7 +486,7 @@ function handleTex(tex, fullmatch) {
|
|||
|
||||
export function parse({raw_content, helper_config}) {
|
||||
function get_linkifier_regexes() {
|
||||
return Array.from(helper_config.get_linkifier_map().keys());
|
||||
return [...helper_config.get_linkifier_map().keys()];
|
||||
}
|
||||
|
||||
function disable_markdown_regex(rules, name) {
|
||||
|
|
|
@ -217,7 +217,7 @@ export function update_messages(events) {
|
|||
if (msg.edit_history === undefined) {
|
||||
msg.edit_history = [];
|
||||
}
|
||||
msg.edit_history = [edit_history_entry].concat(msg.edit_history);
|
||||
msg.edit_history = [edit_history_entry, ...msg.edit_history];
|
||||
}
|
||||
any_message_content_edited = true;
|
||||
|
||||
|
@ -312,7 +312,7 @@ export function update_messages(events) {
|
|||
if (msg.edit_history === undefined) {
|
||||
msg.edit_history = [];
|
||||
}
|
||||
msg.edit_history = [edit_history_entry].concat(msg.edit_history);
|
||||
msg.edit_history = [edit_history_entry, ...msg.edit_history];
|
||||
}
|
||||
msg.last_edit_timestamp = event.edit_timestamp;
|
||||
|
||||
|
|
|
@ -197,7 +197,7 @@ export function load_messages(opts, attempt = 1) {
|
|||
} else {
|
||||
let operators = opts.msg_list.data.filter.public_operators();
|
||||
if (page_params.narrow !== undefined) {
|
||||
operators = operators.concat(page_params.narrow);
|
||||
operators = [...operators, ...page_params.narrow];
|
||||
}
|
||||
data.narrow = JSON.stringify(operators);
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ export const send_read = (function () {
|
|||
start = _.throttle(server_request, 1000);
|
||||
|
||||
function add(messages) {
|
||||
queue = queue.concat(messages);
|
||||
queue = [...queue, ...messages];
|
||||
start();
|
||||
}
|
||||
|
||||
|
|
|
@ -337,10 +337,10 @@ export class MessageListData {
|
|||
|
||||
const viewable_messages = this.unmuted_messages(messages);
|
||||
|
||||
this._all_items = messages.concat(this._all_items);
|
||||
this._all_items = [...messages, ...this._all_items];
|
||||
this._all_items.sort((a, b) => a.id - b.id);
|
||||
|
||||
this._items = viewable_messages.concat(this._items);
|
||||
this._items = [...viewable_messages, ...this._items];
|
||||
this._items.sort((a, b) => a.id - b.id);
|
||||
|
||||
this._add_to_hash(messages);
|
||||
|
@ -351,8 +351,8 @@ export class MessageListData {
|
|||
// Caller should have already filtered
|
||||
const viewable_messages = this.unmuted_messages(messages);
|
||||
|
||||
this._all_items = this._all_items.concat(messages);
|
||||
this._items = this._items.concat(viewable_messages);
|
||||
this._all_items = [...this._all_items, ...messages];
|
||||
this._items = [...this._items, ...viewable_messages];
|
||||
|
||||
this._add_to_hash(messages);
|
||||
return viewable_messages;
|
||||
|
@ -362,8 +362,8 @@ export class MessageListData {
|
|||
// Caller should have already filtered
|
||||
const viewable_messages = this.unmuted_messages(messages);
|
||||
|
||||
this._all_items = messages.concat(this._all_items);
|
||||
this._items = viewable_messages.concat(this._items);
|
||||
this._all_items = [...messages, ...this._all_items];
|
||||
this._items = [...viewable_messages, ...this._items];
|
||||
|
||||
this._add_to_hash(messages);
|
||||
return viewable_messages;
|
||||
|
|
|
@ -541,9 +541,10 @@ export class MessageListView {
|
|||
) {
|
||||
first_msg_container.include_sender = false;
|
||||
}
|
||||
first_group.message_containers = first_group.message_containers.concat(
|
||||
second_group.message_containers,
|
||||
);
|
||||
first_group.message_containers = [
|
||||
...first_group.message_containers,
|
||||
...second_group.message_containers,
|
||||
];
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -626,7 +627,7 @@ export class MessageListView {
|
|||
message_actions.rerender_groups.push(second_group);
|
||||
}
|
||||
message_actions.prepend_groups = new_message_groups;
|
||||
this._message_groups = new_message_groups.concat(this._message_groups);
|
||||
this._message_groups = [...new_message_groups, ...this._message_groups];
|
||||
} else {
|
||||
if (was_joined) {
|
||||
// rerender the last message
|
||||
|
@ -642,7 +643,7 @@ export class MessageListView {
|
|||
}
|
||||
}
|
||||
message_actions.append_groups = new_message_groups;
|
||||
this._message_groups = this._message_groups.concat(new_message_groups);
|
||||
this._message_groups = [...this._message_groups, ...new_message_groups];
|
||||
}
|
||||
|
||||
return message_actions;
|
||||
|
@ -787,7 +788,7 @@ export class MessageListView {
|
|||
|
||||
const new_message_groups = this.build_message_groups(message_containers, this.table_name);
|
||||
const message_actions = this.merge_message_groups(new_message_groups, where);
|
||||
let new_dom_elements = [];
|
||||
const new_dom_elements = [];
|
||||
let $rendered_groups;
|
||||
let $dom_messages;
|
||||
let $last_message_row;
|
||||
|
@ -808,7 +809,7 @@ export class MessageListView {
|
|||
});
|
||||
|
||||
$dom_messages = $rendered_groups.find(".message_row");
|
||||
new_dom_elements = new_dom_elements.concat($rendered_groups);
|
||||
new_dom_elements.push($rendered_groups);
|
||||
|
||||
this._post_process($dom_messages);
|
||||
|
||||
|
@ -857,7 +858,7 @@ export class MessageListView {
|
|||
$last_group_row.append($dom_messages);
|
||||
|
||||
condense.condense_and_collapse($dom_messages);
|
||||
new_dom_elements = new_dom_elements.concat($dom_messages);
|
||||
new_dom_elements.push($dom_messages);
|
||||
}
|
||||
|
||||
// Add new message groups to the end
|
||||
|
@ -872,7 +873,7 @@ export class MessageListView {
|
|||
});
|
||||
|
||||
$dom_messages = $rendered_groups.find(".message_row");
|
||||
new_dom_elements = new_dom_elements.concat($rendered_groups);
|
||||
new_dom_elements.push($rendered_groups);
|
||||
|
||||
this._post_process($dom_messages);
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ export function clear_for_testing(): void {
|
|||
}
|
||||
|
||||
export function user_ids(): number[] {
|
||||
return Array.from(user_set);
|
||||
return [...user_set];
|
||||
}
|
||||
|
||||
export function add_user_id(user_id: number): void {
|
||||
|
|
|
@ -39,7 +39,7 @@ export function is_subscriber_subset(stream_id1, stream_id2) {
|
|||
const sub1_set = get_user_set(stream_id1);
|
||||
const sub2_set = get_user_set(stream_id2);
|
||||
|
||||
return Array.from(sub1_set.keys()).every((key) => sub2_set.has(key));
|
||||
return [...sub1_set.keys()].every((key) => sub2_set.has(key));
|
||||
}
|
||||
|
||||
export function potential_subscribers(stream_id) {
|
||||
|
@ -86,7 +86,7 @@ export function get_subscribers(stream_id) {
|
|||
// want an array of user_ids who are subscribed to a stream.
|
||||
const subscribers = get_user_set(stream_id);
|
||||
|
||||
return Array.from(subscribers.keys());
|
||||
return [...subscribers.keys()];
|
||||
}
|
||||
|
||||
export function set_subscribers(stream_id, user_ids) {
|
||||
|
|
|
@ -864,7 +864,7 @@ export function filter_all_users(pred) {
|
|||
|
||||
export function get_realm_users() {
|
||||
// includes humans and bots from your realm
|
||||
return Array.from(active_user_dict.values());
|
||||
return [...active_user_dict.values()];
|
||||
}
|
||||
|
||||
export function get_active_human_ids() {
|
||||
|
@ -915,11 +915,11 @@ export function get_active_human_count() {
|
|||
|
||||
export function get_active_user_ids() {
|
||||
// This includes active users and active bots.
|
||||
return Array.from(active_user_dict.keys());
|
||||
return [...active_user_dict.keys()];
|
||||
}
|
||||
|
||||
export function get_non_active_realm_users() {
|
||||
return Array.from(non_active_user_dict.values());
|
||||
return [...non_active_user_dict.values()];
|
||||
}
|
||||
|
||||
export function is_cross_realm_email(email) {
|
||||
|
|
|
@ -44,7 +44,7 @@ export function set_up($input, pills, opts) {
|
|||
}
|
||||
|
||||
if (include_user_groups) {
|
||||
source = source.concat(user_group_pill.typeahead_source(pills));
|
||||
source = [...source, ...user_group_pill.typeahead_source(pills)];
|
||||
}
|
||||
|
||||
if (include_users) {
|
||||
|
@ -52,9 +52,9 @@ export function set_up($input, pills, opts) {
|
|||
// If user_source is specified in opts, it
|
||||
// is given priority. Otherwise we use
|
||||
// default user_pill.typeahead_source.
|
||||
source = source.concat(opts.user_source());
|
||||
source = [...source, ...opts.user_source()];
|
||||
} else {
|
||||
source = source.concat(user_pill.typeahead_source(pills));
|
||||
source = [...source, ...user_pill.typeahead_source(pills)];
|
||||
}
|
||||
}
|
||||
return source;
|
||||
|
|
|
@ -490,7 +490,7 @@ function show_user_group_info_popover(element, group, message) {
|
|||
const args = {
|
||||
group_name: group.name,
|
||||
group_description: group.description,
|
||||
members: sort_group_members(fetch_group_members(Array.from(group.members))),
|
||||
members: sort_group_members(fetch_group_members([...group.members])),
|
||||
};
|
||||
$elt.popover({
|
||||
placement: calculate_info_popover_placement(popover_size, $elt),
|
||||
|
|
|
@ -43,7 +43,7 @@ async function decrypt_manual() {
|
|||
? window.electron_bridge.decrypt_clipboard(1)
|
||||
: await decrypt_manual();
|
||||
|
||||
const keyHex = Array.from(key, (b) => b.toString(16).padStart(2, "0")).join("");
|
||||
const keyHex = [...key].map((b) => b.toString(16).padStart(2, "0")).join("");
|
||||
window.open(
|
||||
(window.location.search ? window.location.search + "&" : "?") +
|
||||
"desktop_flow_otp=" +
|
||||
|
|
|
@ -41,7 +41,7 @@ export function get_status(user_id) {
|
|||
}
|
||||
|
||||
export function get_user_ids() {
|
||||
return Array.from(presence_info.keys());
|
||||
return [...presence_info.keys()];
|
||||
}
|
||||
|
||||
export function status_from_raw(raw) {
|
||||
|
|
|
@ -403,7 +403,7 @@ export function get_emojis_used_by_user_for_message_id(message_id) {
|
|||
|
||||
export function get_message_reactions(message) {
|
||||
set_clean_reactions(message);
|
||||
return Array.from(message.clean_reactions.values());
|
||||
return [...message.clean_reactions.values()];
|
||||
}
|
||||
|
||||
export function set_clean_reactions(message) {
|
||||
|
|
|
@ -54,7 +54,7 @@ export function get_pygments_typeahead_list_for_composebox() {
|
|||
const playground_pygment_langs = [...map_language_to_playground_info.keys()];
|
||||
const generated_pygment_langs = Object.keys(generated_pygments_data.langs);
|
||||
|
||||
return playground_pygment_langs.concat(generated_pygment_langs);
|
||||
return [...playground_pygment_langs, ...generated_pygment_langs];
|
||||
}
|
||||
|
||||
// This gets the candidate list for showing autocomplete in settings when
|
||||
|
@ -78,7 +78,7 @@ export function get_pygments_typeahead_list_for_settings(query) {
|
|||
}
|
||||
|
||||
for (const [key, values] of map_pygments_pretty_name_to_aliases) {
|
||||
language_labels.set(key, key + " (" + Array.from(values).join(", ") + ")");
|
||||
language_labels.set(key, key + " (" + values.join(", ") + ")");
|
||||
}
|
||||
|
||||
return language_labels;
|
||||
|
|
|
@ -31,7 +31,7 @@ export class IdTracker {
|
|||
|
||||
max_id() {
|
||||
if (this._cached_max_id === undefined) {
|
||||
this._cached_max_id = _.max(Array.from(this.ids));
|
||||
this._cached_max_id = _.max([...this.ids]);
|
||||
}
|
||||
return this._cached_max_id || -1;
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ export function get_topic_recent_senders(stream_id, topic) {
|
|||
return list2.max_id() - list1.max_id();
|
||||
}
|
||||
|
||||
const sorted_senders = Array.from(sender_dict.entries()).sort(by_max_message_id);
|
||||
const sorted_senders = [...sender_dict.entries()].sort(by_max_message_id);
|
||||
const recent_senders = [];
|
||||
for (const item of sorted_senders) {
|
||||
recent_senders.push(item[0]);
|
||||
|
|
|
@ -43,9 +43,7 @@ export function process_message(msg) {
|
|||
|
||||
function get_sorted_topics() {
|
||||
// Sort all recent topics by last message time.
|
||||
return new Map(
|
||||
Array.from(topics.entries()).sort((a, b) => b[1].last_msg_id - a[1].last_msg_id),
|
||||
);
|
||||
return new Map([...topics.entries()].sort((a, b) => b[1].last_msg_id - a[1].last_msg_id));
|
||||
}
|
||||
|
||||
export function get() {
|
||||
|
|
|
@ -103,7 +103,7 @@ export function clear_for_tests() {
|
|||
}
|
||||
|
||||
export function save_filters() {
|
||||
ls.set(ls_key, Array.from(filters));
|
||||
ls.set(ls_key, [...filters]);
|
||||
}
|
||||
|
||||
export function set_default_focus() {
|
||||
|
@ -784,7 +784,7 @@ export function complete_rerender() {
|
|||
}
|
||||
|
||||
// Show topics list
|
||||
const mapped_topic_values = Array.from(get().values()).map((value) => value);
|
||||
const mapped_topic_values = [...get().values()];
|
||||
|
||||
if (topics_widget) {
|
||||
topics_widget.replace_list_data(mapped_topic_values);
|
||||
|
|
|
@ -48,17 +48,18 @@ const digits =
|
|||
* character of the range, and the last character of the range.
|
||||
* All ranges are concatenated together and stored here.
|
||||
*/
|
||||
const rl_ranges = convert_from_raw(
|
||||
const rl_ranges = [
|
||||
...convert_from_raw(
|
||||
digits,
|
||||
2,
|
||||
'fIfIf}f}g0g0g3g3g6g6g8g"g,g,g/g/g;g;g~hKh?h[h^j1jhjijqjrjCjYj!j~krlplBm2mcmdmimJmOmOmYmYm#m#m*nknooP|j|j',
|
||||
).concat(
|
||||
convert_from_raw(
|
||||
),
|
||||
...convert_from_raw(
|
||||
digits,
|
||||
3,
|
||||
'7S)7S)7S+7S>7S@7YZ7Y#7!n7!U7!(7!*7!+7#07$O7}U81%81(84g84k84k84n84r84w84+84/84<84>86Y86"87Q87Y8gv8g"8k=e)]e,fe,ne-De-Le|je|mf0f',
|
||||
),
|
||||
);
|
||||
];
|
||||
/**
|
||||
* Ranges of strong left-to-right characters.
|
||||
*
|
||||
|
@ -66,18 +67,19 @@ const rl_ranges = convert_from_raw(
|
|||
* character of the range, and the last character of the range.
|
||||
* All ranges are concatenated together and stored here.
|
||||
*/
|
||||
const lr_ranges = convert_from_raw(
|
||||
const lr_ranges = [
|
||||
...convert_from_raw(
|
||||
digits,
|
||||
2,
|
||||
'0$0}151u1<1<1|1|2222282u2w2!2#7Q7T7Z7:7;80848e8e9Q9T9W9$9&9+9.9.9:b1b3cOcWfBfDfEp7pZp"p"p$p(p;p>p@p]q0q9qcqEqGr7r9rcrhrorqrJrMrZr#r*r,r:r=sHsJsMsPsSsVsWs!s#s%t3t6t8tatktnt=t?t]t}t}u1u4u6upusuEuGuUuWvnvpvqvsvsvxvEvGvNvPvZv#w1w3w"w$w:w<xmxvxzxBy5y9ydyhyhymysyvyFyIy"y+y,y.zDzFzTzWz;z>AgAiA>A^B0B2BlBoCxCzCFCJCJCLDIDKDLDTDWDYD%D/E>E@E[E}E}F1FbFiF~G2GsGuGuGwGwGCG{HbHbHhHhHkHoHAHAH-H?H[J0J5J5JcJcJfJgJjJHJKJNJRJ(J-J^J`J{J~K4K6KkKmR>R]SDSOTXTZ!T!V!@!^#h#l#N#R#?#]$l$o$`$}$}%6%d%f%g%s%y%A%A%C%T%%%+%`(k(n(U(W)[)`)}*1*9*b*g*k*n*p*r*u+|,w,S,V,W,Y-p-r-r-z-z-B-B-D-E-N-S-$-%-(.n.D/b/g/"/$/$/+/+/-/;/=:q:A:L:O:?:_:`:}:};2;V;X;X;!;#;%;%;*<z<I<J<M>f>j>j>x>x>F>I>K>P>R>T>W@+[y[C[I{s{u{u{y{I{M{Y{#{:{>|0|3|3|i|i}p}r}D}D}T}+~Z~/~<~<~[~[',
|
||||
).concat(
|
||||
convert_from_raw(
|
||||
),
|
||||
...convert_from_raw(
|
||||
digits,
|
||||
3,
|
||||
'0~_10310510510910d10k10k10m10m10o10o10q10t10v10F10I10L10R10V10!10"10>11s11w11z15}16%17117118f18f18T18=18~19j19>1a$1fU1fU1js1m71s]1s^1tq1tr1t!1t#1t;1t;1t_1uj1uo1w]1w~1x21x61xc1xk1yS1yU1zX1A)1Bz1B!1B!1CY1C+1Fa1Fz1FM1FP1FV1FX1F^1G11G61G71G91Gd1Gg1Gk1Go1Hk1Hp1Hr1Ht1Iq1Is1KD1K:1LE1LH1L~1Mg1MH1ML1N41Nk1Nv1NA1Pi1Pn1Qt1Qw1Q!1Q#2wv2x44|[4}L52452853a53s53V53Y54L54O54"55656f56h57J57L57N57P57S57U57>57[57[57{58758a58&58,59T59W59[5aa5aZ5a*5b25be5bX5b"5ci5ck5cl5cq5cr5ct5c(5c*5dI5dP5dQ5dT5dU5dX5d*5d,5d=5d?5ez5eB5e`5e|5e|5f15f25f55f95fc5fc5fe5fT5fW5f$5f&5is5iu5iv5ix5iA5iC7S(7"67"b7""7""7"[7"[7"{7"~7$Q7$Q7$^7%i7%p7%O7%!7&~7(77(77(f7(f7(w7+c7+e7+/7,Z7,"7,:7,=7,?7->7-@7:v7:Y7;|7<37}T8k>8k>8k@8lH8lX8l)8l}8mm8mq8m.8m=8m>8m[8nX8n"8o68oc8oc8ol8o@8o]8p38p68pV8p&8p;8p?8q_8q}8q~8r18r18r48r98rb8s<8s>8s@8s~8tj8tm8t=8t?8t[8t^8ut8uB8uD8uJ8wT8w#8w$8w)8w)8w+8x_8y18y18y38y68y98y98yc8A$8A*8A/8A<8A<8A?8Bf8Bi8Ca8Cj8Ck8Cm8Cm8Cp8CT8C)8DC8DE8DE8DG8DH8DO8DO8DQ8EY8E#8E$8E*8E*8E:8S+8S=8S=8S_8T;8U88U98Uh8Uh8Uk8Uk8Una|[a||a}Ta}"ba*ba/dFgdFjdFjdFoe72e76e7ee7ve7we7Ee7)e7.e8"e9GebHecDemiemkem:em<enGenIeo8eoaeo%eo(eo;epAeu`evPevSewdewkewmewzewBewWew#ew#ew>eLXeL&eL&eL^eL_eM2eM2eM5eM5eMbe)[f0Yf0"f1,f1[f27f28f2of2of2Ef2Ef2<f2`f39f49f4cf8LfjffjrfjFfjHfjPfjXfk]fl3fl|fmDfmQfmTfnkfnrfnCfnHfn]fn~foufpzfpPfpPfpYfp&fp)fp*fp[fp[fq4fq7fqnfqTfq.frrfrtfIZfI#nl1nl4u|xu|AC$$C$(KG5KG8SiBSiEZ_)Z_,)"9)"c;DF;DI^f-',
|
||||
),
|
||||
convert_from_raw(digits, 4, "0^f:10]d10]g18YJ18YM1gA;1g?A1odh1odk1v?N1v?Q1DV?1DV]1DV]"),
|
||||
);
|
||||
...convert_from_raw(digits, 4, "0^f:10]d10]g18YJ18YM1gA;1g?A1odh1odk1v?N1v?Q1DV?1DV]1DV]"),
|
||||
];
|
||||
|
||||
/**
|
||||
* Gets a character and returns a simplified version of its bidirectional class.
|
||||
|
|
|
@ -159,7 +159,7 @@ function get_group_suggestions(last, operators) {
|
|||
|
||||
// We don't suggest a person if their email is already present in the
|
||||
// operand (not including the last part).
|
||||
const parts = all_but_last_part.split(",").concat(people.my_current_email());
|
||||
const parts = [...all_but_last_part.split(","), people.my_current_email()];
|
||||
|
||||
const person_matcher = people.build_person_matcher(last_part);
|
||||
let persons = people.filter_all_persons((person) => {
|
||||
|
@ -421,7 +421,7 @@ function get_topic_suggestions(last, operators) {
|
|||
|
||||
return topics.map((topic) => {
|
||||
const topic_term = {operator: "topic", operand: topic, negated};
|
||||
const operators = suggest_operators.concat([topic_term]);
|
||||
const operators = [...suggest_operators, topic_term];
|
||||
return format_as_suggestion(operators);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -48,12 +48,12 @@ function get_events_success(events) {
|
|||
}
|
||||
|
||||
if (waiting_on_homeview_load) {
|
||||
events_stored_while_loading = events_stored_while_loading.concat(events);
|
||||
events_stored_while_loading = [...events_stored_while_loading, ...events];
|
||||
return;
|
||||
}
|
||||
|
||||
if (events_stored_while_loading.length > 0) {
|
||||
events = events_stored_while_loading.concat(events);
|
||||
events = [...events_stored_while_loading, ...events];
|
||||
events_stored_while_loading = [];
|
||||
}
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ export function dispatch_normal_event(event) {
|
|||
case "hotspots":
|
||||
hotspots.load_new(event.hotspots);
|
||||
page_params.hotspots = page_params.hotspots
|
||||
? page_params.hotspots.concat(event.hotspots)
|
||||
? [...page_params.hotspots, ...event.hotspots]
|
||||
: event.hotspots;
|
||||
break;
|
||||
|
||||
|
|
|
@ -688,22 +688,25 @@ const other_email_settings = [
|
|||
"enable_marketing_emails",
|
||||
];
|
||||
|
||||
const email_notification_settings = other_email_settings.concat(
|
||||
email_message_notification_settings,
|
||||
);
|
||||
const email_notification_settings = [
|
||||
...other_email_settings,
|
||||
...email_message_notification_settings,
|
||||
];
|
||||
|
||||
const other_notification_settings = desktop_notification_settings.concat(
|
||||
["desktop_icon_count_display"],
|
||||
mobile_notification_settings,
|
||||
email_notification_settings,
|
||||
["email_notifications_batching_period_seconds"],
|
||||
["notification_sound"],
|
||||
);
|
||||
const other_notification_settings = [
|
||||
...desktop_notification_settings,
|
||||
"desktop_icon_count_display",
|
||||
...mobile_notification_settings,
|
||||
...email_notification_settings,
|
||||
"email_notifications_batching_period_seconds",
|
||||
"notification_sound",
|
||||
];
|
||||
|
||||
export const all_notification_settings = other_notification_settings.concat(
|
||||
pm_mention_notification_settings,
|
||||
stream_notification_settings,
|
||||
);
|
||||
export const all_notification_settings = [
|
||||
...other_notification_settings,
|
||||
...pm_mention_notification_settings,
|
||||
...stream_notification_settings,
|
||||
];
|
||||
|
||||
type Settings = UserSettings | RealmDefaultSettings;
|
||||
type PageParamsItem = keyof Settings;
|
||||
|
|
|
@ -207,7 +207,7 @@ export function extract_property_name($elem, for_realm_default_settings) {
|
|||
}
|
||||
|
||||
export function get_subsection_property_elements(subsection) {
|
||||
return Array.from($(subsection).find(".prop-element"));
|
||||
return [...$(subsection).find(".prop-element")];
|
||||
}
|
||||
|
||||
const simple_dropdown_properties = [
|
||||
|
@ -1059,7 +1059,7 @@ function check_maximum_valid_value($custom_input_elem, property_name) {
|
|||
}
|
||||
|
||||
function enable_or_disable_save_button($subsection_elem) {
|
||||
const time_limit_settings = Array.from($subsection_elem.find(".time-limit-setting"));
|
||||
const time_limit_settings = [...$subsection_elem.find(".time-limit-setting")];
|
||||
let disable_save_btn = false;
|
||||
for (const setting_elem of time_limit_settings) {
|
||||
const $dropdown_elem = $(setting_elem).find("select");
|
||||
|
|
|
@ -166,7 +166,7 @@ function build_page() {
|
|||
$search_pygments_box.typeahead({
|
||||
source(query) {
|
||||
language_labels = realm_playground.get_pygments_typeahead_list_for_settings(query);
|
||||
return Array.from(language_labels.keys());
|
||||
return [...language_labels.keys()];
|
||||
},
|
||||
items: 5,
|
||||
fixed: true,
|
||||
|
|
|
@ -108,7 +108,7 @@ export function populate_user_groups() {
|
|||
function is_user_group_changed() {
|
||||
const draft_group = get_pill_user_ids();
|
||||
const group_data = user_groups.get_user_group_from_id(data.id);
|
||||
const original_group = Array.from(group_data.members);
|
||||
const original_group = [...group_data.members];
|
||||
const same_groups = _.isEqual(_.sortBy(draft_group), _.sortBy(original_group));
|
||||
const description = $(`#user-groups #${CSS.escape(data.id)} .description`)
|
||||
.text()
|
||||
|
@ -172,7 +172,7 @@ export function populate_user_groups() {
|
|||
function save_members() {
|
||||
const draft_group = get_pill_user_ids();
|
||||
const group_data = user_groups.get_user_group_from_id(data.id);
|
||||
const original_group = Array.from(group_data.members);
|
||||
const original_group = [...group_data.members];
|
||||
const same_groups = _.isEqual(_.sortBy(draft_group), _.sortBy(original_group));
|
||||
if (!draft_group.length || same_groups) {
|
||||
return;
|
||||
|
|
|
@ -37,7 +37,7 @@ export function get_count() {
|
|||
}
|
||||
|
||||
export function get_starred_msg_ids() {
|
||||
return Array.from(starred_ids);
|
||||
return [...starred_ids];
|
||||
}
|
||||
|
||||
export function get_count_in_topic(stream_id, topic) {
|
||||
|
@ -45,7 +45,7 @@ export function get_count_in_topic(stream_id, topic) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
const messages = Array.from(starred_ids).filter((id) => {
|
||||
const messages = [...starred_ids].filter((id) => {
|
||||
const message = message_store.get(id);
|
||||
|
||||
if (message === undefined) {
|
||||
|
|
|
@ -487,7 +487,7 @@ function compute_summary_chart_data(time_series_data, num_steps, labels_) {
|
|||
}
|
||||
data.set(key, sum);
|
||||
}
|
||||
const labels = labels_.slice();
|
||||
const labels = [...labels_];
|
||||
const values = [];
|
||||
for (const label of labels) {
|
||||
if (data.has(label)) {
|
||||
|
|
|
@ -10,7 +10,7 @@ export function initialize_with_current_user() {
|
|||
}
|
||||
|
||||
export function sorted_user_ids() {
|
||||
const users = people.get_users_from_ids(Array.from(user_id_set));
|
||||
const users = people.get_users_from_ids([...user_id_set]);
|
||||
people.sort_but_pin_current_user_on_top(users);
|
||||
return users.map((user) => user.user_id);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ export function get_all_user_ids() {
|
|||
|
||||
export function get_principals() {
|
||||
// Return list of user ids which were selected by user.
|
||||
return Array.from(user_id_set);
|
||||
return [...user_id_set];
|
||||
}
|
||||
|
||||
export function get_potential_subscribers() {
|
||||
|
|
|
@ -355,14 +355,14 @@ export function delete_sub(stream_id) {
|
|||
}
|
||||
|
||||
export function get_non_default_stream_names() {
|
||||
let subs = Array.from(stream_info.values());
|
||||
let subs = [...stream_info.values()];
|
||||
subs = subs.filter((sub) => !is_default_stream_id(sub.stream_id) && !sub.invite_only);
|
||||
const names = subs.map((sub) => sub.name);
|
||||
return names;
|
||||
}
|
||||
|
||||
export function get_unsorted_subs() {
|
||||
return Array.from(stream_info.values());
|
||||
return [...stream_info.values()];
|
||||
}
|
||||
|
||||
export function num_subscribed_subs() {
|
||||
|
@ -370,11 +370,11 @@ export function num_subscribed_subs() {
|
|||
}
|
||||
|
||||
export function subscribed_subs() {
|
||||
return Array.from(stream_info.true_values());
|
||||
return [...stream_info.true_values()];
|
||||
}
|
||||
|
||||
export function unsubscribed_subs() {
|
||||
return Array.from(stream_info.false_values());
|
||||
return [...stream_info.false_values()];
|
||||
}
|
||||
|
||||
export function subscribed_streams() {
|
||||
|
@ -687,7 +687,7 @@ export function set_realm_default_streams(realm_default_streams) {
|
|||
}
|
||||
|
||||
export function get_default_stream_ids() {
|
||||
return Array.from(default_stream_ids);
|
||||
return [...default_stream_ids];
|
||||
}
|
||||
|
||||
export function is_default_stream_id(stream_id) {
|
||||
|
@ -821,7 +821,7 @@ export function get_streams_for_admin() {
|
|||
return util.strcmp(a.name, b.name);
|
||||
}
|
||||
|
||||
const subs = Array.from(stream_info.values());
|
||||
const subs = [...stream_info.values()];
|
||||
|
||||
subs.sort(by_name);
|
||||
|
||||
|
|
|
@ -157,7 +157,7 @@ function subscribe_new_users({pill_user_ids}) {
|
|||
}
|
||||
let ignored_deactivated_users;
|
||||
if (deactivated_users.size > 0) {
|
||||
ignored_deactivated_users = Array.from(deactivated_users);
|
||||
ignored_deactivated_users = [...deactivated_users];
|
||||
ignored_deactivated_users = ignored_deactivated_users.map((user_id) =>
|
||||
people.get_by_user_id(user_id),
|
||||
);
|
||||
|
@ -172,7 +172,7 @@ function subscribe_new_users({pill_user_ids}) {
|
|||
return;
|
||||
}
|
||||
|
||||
const user_ids = Array.from(user_id_set);
|
||||
const user_ids = [...user_id_set];
|
||||
|
||||
function invite_success(data) {
|
||||
pill_widget.clear();
|
||||
|
|
|
@ -42,7 +42,7 @@ function get_user_ids_from_subs(items) {
|
|||
for (const item of items) {
|
||||
// only some of our items have streams (for copy-from-stream)
|
||||
if (item.stream_id !== undefined) {
|
||||
user_ids = user_ids.concat(peer_data.get_subscribers(item.stream_id));
|
||||
user_ids = [...user_ids, ...peer_data.get_subscribers(item.stream_id)];
|
||||
}
|
||||
}
|
||||
return user_ids;
|
||||
|
@ -51,7 +51,7 @@ function get_user_ids_from_subs(items) {
|
|||
export function get_user_ids(pill_widget) {
|
||||
const items = pill_widget.items();
|
||||
let user_ids = get_user_ids_from_subs(items);
|
||||
user_ids = Array.from(new Set(user_ids));
|
||||
user_ids = [...new Set(user_ids)];
|
||||
|
||||
user_ids = user_ids.filter(Boolean);
|
||||
user_ids.sort((a, b) => a - b);
|
||||
|
|
|
@ -105,7 +105,7 @@ export function get_streams_for_settings_page() {
|
|||
}
|
||||
subscribed_rows.sort(by_name);
|
||||
unsubscribed_rows.sort(by_name);
|
||||
const all_subs = unsubscribed_rows.concat(subscribed_rows);
|
||||
const all_subs = [...unsubscribed_rows, ...subscribed_rows];
|
||||
|
||||
return get_subs_for_settings(all_subs);
|
||||
}
|
||||
|
|
|
@ -88,12 +88,13 @@ export function sort_groups(streams, search_term) {
|
|||
previous_muted_active = muted_active_streams;
|
||||
previous_dormant = dormant_streams;
|
||||
|
||||
all_streams = pinned_streams.concat(
|
||||
muted_pinned_streams,
|
||||
normal_streams,
|
||||
muted_active_streams,
|
||||
dormant_streams,
|
||||
);
|
||||
all_streams = [
|
||||
...pinned_streams,
|
||||
...muted_pinned_streams,
|
||||
...normal_streams,
|
||||
...muted_active_streams,
|
||||
...dormant_streams,
|
||||
];
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
|
@ -199,7 +199,7 @@ export class PerStreamHistory {
|
|||
}
|
||||
|
||||
get_recent_topic_names() {
|
||||
const my_recents = Array.from(this.topics.values());
|
||||
const my_recents = [...this.topics.values()];
|
||||
|
||||
/* Add any older topics with unreads that may not be present
|
||||
* in our local cache. */
|
||||
|
@ -208,7 +208,7 @@ export class PerStreamHistory {
|
|||
topic_dict: this.topics,
|
||||
});
|
||||
|
||||
const recents = my_recents.concat(missing_topics);
|
||||
const recents = [...my_recents, ...missing_topics];
|
||||
|
||||
recents.sort((a, b) => b.message_id - a.message_id);
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ export class TaskData {
|
|||
}
|
||||
|
||||
get_widget_data() {
|
||||
const all_tasks = Array.from(this.task_map.values());
|
||||
const all_tasks = [...this.task_map.values()];
|
||||
all_tasks.sort((a, b) => util.strcmp(a.task, b.task));
|
||||
|
||||
const pending_tasks = [];
|
||||
|
|
|
@ -52,7 +52,7 @@ export function close() {
|
|||
export function zoom_out() {
|
||||
zoomed = false;
|
||||
|
||||
const stream_ids = Array.from(active_widgets.keys());
|
||||
const stream_ids = [...active_widgets.keys()];
|
||||
|
||||
if (stream_ids.length !== 1) {
|
||||
blueslip.error("Unexpected number of topic lists to zoom out.");
|
||||
|
@ -198,7 +198,7 @@ export function clear_topic_search(e) {
|
|||
|
||||
// Since this changes the contents of the search input, we
|
||||
// need to rerender the topic list.
|
||||
const stream_ids = Array.from(active_widgets.keys());
|
||||
const stream_ids = [...active_widgets.keys()];
|
||||
|
||||
const stream_id = stream_ids[0];
|
||||
const widget = active_widgets.get(stream_id);
|
||||
|
@ -209,7 +209,7 @@ export function clear_topic_search(e) {
|
|||
}
|
||||
|
||||
export function active_stream_id() {
|
||||
const stream_ids = Array.from(active_widgets.keys());
|
||||
const stream_ids = [...active_widgets.keys()];
|
||||
|
||||
if (stream_ids.length !== 1) {
|
||||
return undefined;
|
||||
|
@ -219,7 +219,7 @@ export function active_stream_id() {
|
|||
}
|
||||
|
||||
export function get_stream_li() {
|
||||
const widgets = Array.from(active_widgets.values());
|
||||
const widgets = [...active_widgets.values()];
|
||||
|
||||
if (widgets.length !== 1) {
|
||||
return undefined;
|
||||
|
|
|
@ -146,7 +146,7 @@ export function render_emoji(item) {
|
|||
|
||||
export function sorter(query, objs, get_item) {
|
||||
const results = typeahead.triage(query, objs, get_item);
|
||||
return results.matches.concat(results.rest);
|
||||
return [...results.matches, ...results.rest];
|
||||
}
|
||||
|
||||
export function compare_by_pms(user_a, user_b) {
|
||||
|
@ -353,7 +353,7 @@ export function sort_languages(matches, query) {
|
|||
|
||||
// Languages that have the query somewhere in their name
|
||||
results.rest = results.rest.sort(compare_language);
|
||||
return retain_unique_language_aliases(results.matches.concat(results.rest));
|
||||
return retain_unique_language_aliases([...results.matches, ...results.rest]);
|
||||
}
|
||||
|
||||
export function sort_recipients({
|
||||
|
@ -394,7 +394,7 @@ export function sort_recipients({
|
|||
|
||||
for (const getter of getters) {
|
||||
if (items.length < max_num_items) {
|
||||
items = items.concat(getter());
|
||||
items = [...items, ...getter()];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -418,7 +418,7 @@ export function sort_slash_commands(matches, query) {
|
|||
|
||||
results.matches = results.matches.sort(slash_command_comparator);
|
||||
results.rest = results.rest.sort(slash_command_comparator);
|
||||
return results.matches.concat(results.rest);
|
||||
return [...results.matches, ...results.rest];
|
||||
}
|
||||
|
||||
// Gives stream a score from 0 to 3 based on its activity
|
||||
|
@ -465,5 +465,5 @@ export function sort_streams(matches, query) {
|
|||
// Streams with names and descriptions that don't start with the query.
|
||||
desc_results.rest = desc_results.rest.sort(compare_by_activity);
|
||||
|
||||
return name_results.matches.concat(desc_results.matches.concat(desc_results.rest));
|
||||
return [...name_results.matches, ...desc_results.matches, ...desc_results.rest];
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ export function get_group_typists(group) {
|
|||
}
|
||||
|
||||
export function get_all_typists() {
|
||||
let typists = Array.from(typist_dct.values()).flat();
|
||||
let typists = [...typist_dct.values()].flat();
|
||||
typists = util.sorted_ids(typists);
|
||||
return muted_users.filter_muted_user_ids(typists);
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ function get_users_typing_for_narrow() {
|
|||
const narrow_user_ids = narrow_user_ids_string
|
||||
.split(",")
|
||||
.map((user_id_string) => Number.parseInt(user_id_string, 10));
|
||||
const group = narrow_user_ids.concat([page_params.user_id]);
|
||||
const group = [...narrow_user_ids, page_params.user_id];
|
||||
return typing_data.get_group_typists(group);
|
||||
}
|
||||
// Get all users typing (in all private conversations with current user)
|
||||
|
|
|
@ -209,7 +209,7 @@ class UnreadPMCounter {
|
|||
return [];
|
||||
}
|
||||
|
||||
const ids = Array.from(bucket);
|
||||
const ids = [...bucket];
|
||||
return util.sorted_ids(ids);
|
||||
}
|
||||
}
|
||||
|
@ -309,12 +309,12 @@ class UnreadTopicCounter {
|
|||
return [];
|
||||
}
|
||||
|
||||
let topic_names = Array.from(per_stream_bucketer.keys());
|
||||
let topic_names = [...per_stream_bucketer.keys()];
|
||||
|
||||
/* Include topics that have at least one unread. It would likely
|
||||
* be better design for buckets to be deleted when emptied. */
|
||||
topic_names = topic_names.filter((topic_name) => {
|
||||
const messages = Array.from(per_stream_bucketer.get_bucket(topic_name));
|
||||
const messages = [...per_stream_bucketer.get_bucket(topic_name)];
|
||||
return messages.length > 0;
|
||||
});
|
||||
/* And aren't already present in topic_dict. */
|
||||
|
@ -325,7 +325,7 @@ class UnreadTopicCounter {
|
|||
|
||||
return {
|
||||
pretty_name: topic_name,
|
||||
message_id: Math.max(...Array.from(msgs)),
|
||||
message_id: Math.max(...msgs),
|
||||
};
|
||||
});
|
||||
|
||||
|
@ -396,7 +396,7 @@ class UnreadTopicCounter {
|
|||
return [];
|
||||
}
|
||||
|
||||
const ids = Array.from(topic_bucket);
|
||||
const ids = [...topic_bucket];
|
||||
return util.sorted_ids(ids);
|
||||
}
|
||||
|
||||
|
@ -707,7 +707,7 @@ export function get_counts() {
|
|||
const streams_with_mentions = unread_topic_counter.get_streams_with_unread_mentions();
|
||||
res.home_unread_messages = topic_res.stream_unread_messages;
|
||||
res.stream_count = topic_res.stream_count;
|
||||
res.streams_with_mentions = Array.from(streams_with_mentions);
|
||||
res.streams_with_mentions = [...streams_with_mentions];
|
||||
|
||||
const pm_res = unread_pm_counter.get_counts();
|
||||
res.pm_count = pm_res.pm_dict;
|
||||
|
@ -797,13 +797,13 @@ export function get_msg_ids_for_private() {
|
|||
}
|
||||
|
||||
export function get_msg_ids_for_mentions() {
|
||||
const ids = Array.from(unread_mentions_counter);
|
||||
const ids = [...unread_mentions_counter];
|
||||
|
||||
return util.sorted_ids(ids);
|
||||
}
|
||||
|
||||
export function get_all_msg_ids() {
|
||||
const ids = Array.from(unread_messages);
|
||||
const ids = [...unread_messages];
|
||||
|
||||
return util.sorted_ids(ids);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ export function initialize_with_current_user() {
|
|||
}
|
||||
|
||||
export function sorted_user_ids() {
|
||||
const users = people.get_users_from_ids(Array.from(user_id_set));
|
||||
const users = people.get_users_from_ids([...user_id_set]);
|
||||
people.sort_but_pin_current_user_on_top(users);
|
||||
return users.map((user) => user.user_id);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ export function get_all_user_ids() {
|
|||
|
||||
export function get_principals() {
|
||||
// Return list of user ids which were selected by user.
|
||||
return Array.from(user_id_set);
|
||||
return [...user_id_set];
|
||||
}
|
||||
|
||||
export function get_potential_members() {
|
||||
|
|
|
@ -111,7 +111,7 @@ export function handle_member_edit_event(group_id) {
|
|||
const group = user_groups.get_user_group_from_id(group_id);
|
||||
|
||||
// update members list.
|
||||
const members = Array.from(group.members);
|
||||
const members = [...group.members];
|
||||
user_group_edit_members.update_member_list_widget(group_id, members);
|
||||
|
||||
// update_settings buttons.
|
||||
|
|
|
@ -97,7 +97,7 @@ export function enable_member_management({group, $parent_container}) {
|
|||
member_list_widget = make_list_widget({
|
||||
$parent_container,
|
||||
name: "user_group_members",
|
||||
user_ids: Array.from(group.members),
|
||||
user_ids: [...group.members],
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -179,13 +179,13 @@ function add_new_members({pill_user_ids}) {
|
|||
let ignored_deactivated_users;
|
||||
let ignored_already_added_users;
|
||||
if (deactivated_users.size > 0) {
|
||||
ignored_deactivated_users = Array.from(deactivated_users);
|
||||
ignored_deactivated_users = [...deactivated_users];
|
||||
ignored_deactivated_users = ignored_deactivated_users.map((user_id) =>
|
||||
people.get_by_user_id(user_id),
|
||||
);
|
||||
}
|
||||
if (already_added_users.size > 0) {
|
||||
ignored_already_added_users = Array.from(already_added_users);
|
||||
ignored_already_added_users = [...already_added_users];
|
||||
ignored_already_added_users = ignored_already_added_users.map((user_id) =>
|
||||
people.get_by_user_id(user_id),
|
||||
);
|
||||
|
@ -201,7 +201,7 @@ function add_new_members({pill_user_ids}) {
|
|||
});
|
||||
return;
|
||||
}
|
||||
const user_ids = Array.from(user_id_set);
|
||||
const user_ids = [...user_id_set];
|
||||
|
||||
function invite_success() {
|
||||
pill_widget.clear();
|
||||
|
|
|
@ -31,19 +31,16 @@ export function get_group_name_from_item(item) {
|
|||
}
|
||||
|
||||
function get_user_ids_from_user_groups(items) {
|
||||
let user_ids = [];
|
||||
const group_ids = items.map((item) => item.id).filter(Boolean);
|
||||
for (const group_id of group_ids) {
|
||||
const user_group = user_groups.get_user_group_from_id(group_id);
|
||||
user_ids = user_ids.concat(Array.from(user_group.members));
|
||||
}
|
||||
return user_ids;
|
||||
return group_ids.flatMap((group_id) => [
|
||||
...user_groups.get_user_group_from_id(group_id).members,
|
||||
]);
|
||||
}
|
||||
|
||||
export function get_user_ids(pill_widget) {
|
||||
const items = pill_widget.items();
|
||||
let user_ids = get_user_ids_from_user_groups(items);
|
||||
user_ids = Array.from(new Set(user_ids));
|
||||
user_ids = [...new Set(user_ids)];
|
||||
user_ids.sort((a, b) => a - b);
|
||||
|
||||
user_ids = user_ids.filter(Boolean);
|
||||
|
|
|
@ -81,7 +81,7 @@ export function get_user_group_from_name(name: string): UserGroup | undefined {
|
|||
}
|
||||
|
||||
export function get_realm_user_groups(): UserGroup[] {
|
||||
const user_groups = Array.from(user_group_by_id_dict.values()).sort((a, b) => a.id - b.id);
|
||||
const user_groups = [...user_group_by_id_dict.values()].sort((a, b) => a.id - b.id);
|
||||
return user_groups.filter((group) => !group.is_system_group);
|
||||
}
|
||||
|
||||
|
@ -239,5 +239,5 @@ export function get_realm_user_groups_for_dropdown_list_widget(
|
|||
value: group.id.toString(),
|
||||
}));
|
||||
|
||||
return system_user_groups.concat(user_groups_excluding_system_groups);
|
||||
return [...system_user_groups, ...user_groups_excluding_system_groups];
|
||||
}
|
||||
|
|
|
@ -224,7 +224,7 @@ export function sorted_ids(ids: string[]): number[] {
|
|||
// This mapping makes sure we are using ints, and
|
||||
// it also makes sure we don't mutate the list.
|
||||
let id_list = ids.map((s) => Number.parseInt(s, 10));
|
||||
id_list = Array.from(new Set(id_list));
|
||||
id_list = [...new Set(id_list)];
|
||||
id_list.sort((a, b) => a - b);
|
||||
|
||||
return id_list;
|
||||
|
|
|
@ -20,7 +20,7 @@ function make_tab(i) {
|
|||
$self.addClass = (c) => {
|
||||
$self.class += " " + c;
|
||||
const tokens = $self.class.trim().split(/ +/);
|
||||
$self.class = Array.from(new Set(tokens)).join(" ");
|
||||
$self.class = [...new Set(tokens)].join(" ");
|
||||
};
|
||||
|
||||
$self.removeClass = (c) => {
|
||||
|
|
|
@ -53,7 +53,7 @@ run_test("pills", ({override}) => {
|
|||
assert.ok(!all_pills.has(id));
|
||||
all_pills.set(id, item);
|
||||
};
|
||||
pills.items = () => Array.from(all_pills.values());
|
||||
pills.items = () => [...all_pills.values()];
|
||||
|
||||
let text_cleared;
|
||||
pills.clear_text = () => {
|
||||
|
|
|
@ -160,7 +160,7 @@ const emojis_by_name = new Map(
|
|||
headphones: emoji_headphones,
|
||||
}),
|
||||
);
|
||||
const emoji_list = Array.from(emojis_by_name.values(), (emoji_dict) => ({
|
||||
const emoji_list = [...emojis_by_name.values()].map((emoji_dict) => ({
|
||||
emoji_name: emoji_dict.name,
|
||||
emoji_code: emoji_dict.emoji_code,
|
||||
reaction_type: "unicode_emoji",
|
||||
|
@ -221,7 +221,7 @@ for (const [key, val] of emojis_by_name.entries()) {
|
|||
|
||||
const emoji_codes = {
|
||||
name_to_codepoint,
|
||||
names: Array.from(emojis_by_name.keys()),
|
||||
names: [...emojis_by_name.keys()],
|
||||
emoji_catalog: {},
|
||||
emoticon_conversions: {},
|
||||
codepoint_to_name: {},
|
||||
|
|
|
@ -276,41 +276,41 @@ test("basics", () => {
|
|||
function assert_not_mark_read_with_has_operands(additional_operators_to_test) {
|
||||
additional_operators_to_test = additional_operators_to_test || [];
|
||||
let has_operator = [{operator: "has", operand: "link"}];
|
||||
let filter = new Filter(additional_operators_to_test.concat(has_operator));
|
||||
let filter = new Filter([...additional_operators_to_test, ...has_operator]);
|
||||
assert.ok(!filter.can_mark_messages_read());
|
||||
|
||||
has_operator = [{operator: "has", operand: "link", negated: true}];
|
||||
filter = new Filter(additional_operators_to_test.concat(has_operator));
|
||||
filter = new Filter([...additional_operators_to_test, ...has_operator]);
|
||||
assert.ok(!filter.can_mark_messages_read());
|
||||
|
||||
has_operator = [{operator: "has", operand: "image"}];
|
||||
filter = new Filter(additional_operators_to_test.concat(has_operator));
|
||||
filter = new Filter([...additional_operators_to_test, ...has_operator]);
|
||||
assert.ok(!filter.can_mark_messages_read());
|
||||
|
||||
has_operator = [{operator: "has", operand: "image", negated: true}];
|
||||
filter = new Filter(additional_operators_to_test.concat(has_operator));
|
||||
filter = new Filter([...additional_operators_to_test, ...has_operator]);
|
||||
assert.ok(!filter.can_mark_messages_read());
|
||||
|
||||
has_operator = [{operator: "has", operand: "attachment", negated: true}];
|
||||
filter = new Filter(additional_operators_to_test.concat(has_operator));
|
||||
filter = new Filter([...additional_operators_to_test, ...has_operator]);
|
||||
assert.ok(!filter.can_mark_messages_read());
|
||||
|
||||
has_operator = [{operator: "has", operand: "attachment"}];
|
||||
filter = new Filter(additional_operators_to_test.concat(has_operator));
|
||||
filter = new Filter([...additional_operators_to_test, ...has_operator]);
|
||||
assert.ok(!filter.can_mark_messages_read());
|
||||
}
|
||||
function assert_not_mark_read_with_is_operands(additional_operators_to_test) {
|
||||
additional_operators_to_test = additional_operators_to_test || [];
|
||||
let is_operator = [{operator: "is", operand: "starred"}];
|
||||
let filter = new Filter(additional_operators_to_test.concat(is_operator));
|
||||
let filter = new Filter([...additional_operators_to_test, ...is_operator]);
|
||||
assert.ok(!filter.can_mark_messages_read());
|
||||
|
||||
is_operator = [{operator: "is", operand: "starred", negated: true}];
|
||||
filter = new Filter(additional_operators_to_test.concat(is_operator));
|
||||
filter = new Filter([...additional_operators_to_test, ...is_operator]);
|
||||
assert.ok(!filter.can_mark_messages_read());
|
||||
|
||||
is_operator = [{operator: "is", operand: "mentioned"}];
|
||||
filter = new Filter(additional_operators_to_test.concat(is_operator));
|
||||
filter = new Filter([...additional_operators_to_test, ...is_operator]);
|
||||
if (additional_operators_to_test.length === 0) {
|
||||
assert.ok(filter.can_mark_messages_read());
|
||||
} else {
|
||||
|
@ -318,27 +318,27 @@ function assert_not_mark_read_with_is_operands(additional_operators_to_test) {
|
|||
}
|
||||
|
||||
is_operator = [{operator: "is", operand: "mentioned", negated: true}];
|
||||
filter = new Filter(additional_operators_to_test.concat(is_operator));
|
||||
filter = new Filter([...additional_operators_to_test, ...is_operator]);
|
||||
assert.ok(!filter.can_mark_messages_read());
|
||||
|
||||
is_operator = [{operator: "is", operand: "alerted"}];
|
||||
filter = new Filter(additional_operators_to_test.concat(is_operator));
|
||||
filter = new Filter([...additional_operators_to_test, ...is_operator]);
|
||||
assert.ok(!filter.can_mark_messages_read());
|
||||
|
||||
is_operator = [{operator: "is", operand: "alerted", negated: true}];
|
||||
filter = new Filter(additional_operators_to_test.concat(is_operator));
|
||||
filter = new Filter([...additional_operators_to_test, ...is_operator]);
|
||||
assert.ok(!filter.can_mark_messages_read());
|
||||
|
||||
is_operator = [{operator: "is", operand: "unread"}];
|
||||
filter = new Filter(additional_operators_to_test.concat(is_operator));
|
||||
filter = new Filter([...additional_operators_to_test, ...is_operator]);
|
||||
assert.ok(!filter.can_mark_messages_read());
|
||||
|
||||
is_operator = [{operator: "is", operand: "unread", negated: true}];
|
||||
filter = new Filter(additional_operators_to_test.concat(is_operator));
|
||||
filter = new Filter([...additional_operators_to_test, ...is_operator]);
|
||||
assert.ok(!filter.can_mark_messages_read());
|
||||
|
||||
is_operator = [{operator: "is", operand: "resolved"}];
|
||||
filter = new Filter(additional_operators_to_test.concat(is_operator));
|
||||
filter = new Filter([...additional_operators_to_test, ...is_operator]);
|
||||
if (additional_operators_to_test.length === 0) {
|
||||
assert.ok(filter.can_mark_messages_read());
|
||||
} else {
|
||||
|
@ -346,18 +346,18 @@ function assert_not_mark_read_with_is_operands(additional_operators_to_test) {
|
|||
}
|
||||
|
||||
is_operator = [{operator: "is", operand: "resolved", negated: true}];
|
||||
filter = new Filter(additional_operators_to_test.concat(is_operator));
|
||||
filter = new Filter([...additional_operators_to_test, ...is_operator]);
|
||||
assert.ok(!filter.can_mark_messages_read());
|
||||
}
|
||||
|
||||
function assert_not_mark_read_when_searching(additional_operators_to_test) {
|
||||
additional_operators_to_test = additional_operators_to_test || [];
|
||||
let search_op = [{operator: "search", operand: "keyword"}];
|
||||
let filter = new Filter(additional_operators_to_test.concat(search_op));
|
||||
let filter = new Filter([...additional_operators_to_test, ...search_op]);
|
||||
assert.ok(!filter.can_mark_messages_read());
|
||||
|
||||
search_op = [{operator: "search", operand: "keyword", negated: true}];
|
||||
filter = new Filter(additional_operators_to_test.concat(search_op));
|
||||
filter = new Filter([...additional_operators_to_test, ...search_op]);
|
||||
assert.ok(!filter.can_mark_messages_read());
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ run_test("basic", () => {
|
|||
|
||||
assert.equal(d.size, 0);
|
||||
|
||||
assert.deepEqual(Array.from(d.keys()), []);
|
||||
assert.deepEqual([...d.keys()], []);
|
||||
|
||||
d.set("foo", "bar");
|
||||
assert.equal(d.get("foo"), "bar");
|
||||
|
@ -30,18 +30,21 @@ run_test("basic", () => {
|
|||
assert.equal(d.has("bar"), true);
|
||||
assert.equal(d.has("baz"), false);
|
||||
|
||||
assert.deepEqual(Array.from(d.keys()), ["foo", "bar"]);
|
||||
assert.deepEqual(Array.from(d.values()), ["baz", "qux"]);
|
||||
assert.deepEqual(Array.from(d), [
|
||||
assert.deepEqual([...d.keys()], ["foo", "bar"]);
|
||||
assert.deepEqual([...d.values()], ["baz", "qux"]);
|
||||
assert.deepEqual(
|
||||
[...d],
|
||||
[
|
||||
["foo", "baz"],
|
||||
["bar", "qux"],
|
||||
]);
|
||||
],
|
||||
);
|
||||
|
||||
d.delete("bar");
|
||||
assert.equal(d.has("bar"), false);
|
||||
assert.strictEqual(d.get("bar"), undefined);
|
||||
|
||||
assert.deepEqual(Array.from(d.keys()), ["foo"]);
|
||||
assert.deepEqual([...d.keys()], ["foo"]);
|
||||
|
||||
const val = ["foo"];
|
||||
const res = d.set("abc", val);
|
||||
|
@ -51,7 +54,7 @@ run_test("basic", () => {
|
|||
run_test("case insensitivity", () => {
|
||||
const d = new FoldDict();
|
||||
|
||||
assert.deepEqual(Array.from(d.keys()), []);
|
||||
assert.deepEqual([...d.keys()], []);
|
||||
|
||||
assert.ok(!d.has("foo"));
|
||||
d.set("fOO", "Hello world");
|
||||
|
@ -60,12 +63,12 @@ run_test("case insensitivity", () => {
|
|||
assert.ok(d.has("FOO"));
|
||||
assert.ok(!d.has("not_a_key"));
|
||||
|
||||
assert.deepEqual(Array.from(d.keys()), ["fOO"]);
|
||||
assert.deepEqual([...d.keys()], ["fOO"]);
|
||||
|
||||
d.delete("Foo");
|
||||
assert.equal(d.has("foo"), false);
|
||||
|
||||
assert.deepEqual(Array.from(d.keys()), []);
|
||||
assert.deepEqual([...d.keys()], []);
|
||||
});
|
||||
|
||||
run_test("clear", () => {
|
||||
|
|
|
@ -14,7 +14,7 @@ function make_zblueslip() {
|
|||
warn: true,
|
||||
error: true,
|
||||
};
|
||||
const names = Array.from(Object.keys(opts));
|
||||
const names = Object.keys(opts);
|
||||
|
||||
// For fatal messages, we should use assert.throws
|
||||
/* istanbul ignore next */
|
||||
|
|
|
@ -159,7 +159,7 @@ function make_zjquery() {
|
|||
/* istanbul ignore next */
|
||||
zjquery.state = function () {
|
||||
// useful for debugging
|
||||
let res = Array.from(elems.values(), ($v) => $v.debug());
|
||||
let res = [...elems.values()].map(($v) => $v.debug());
|
||||
|
||||
res = res.map((v) => [v.selector, v.value, v.shown]);
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ const linkifiers = zrequire("linkifiers");
|
|||
linkifiers.initialize([]);
|
||||
|
||||
function get_linkifier_regexes() {
|
||||
return Array.from(linkifiers.get_linkifier_map().keys());
|
||||
return [...linkifiers.get_linkifier_map().keys()];
|
||||
}
|
||||
|
||||
run_test("python_to_js_linkifier", () => {
|
||||
|
|
|
@ -258,13 +258,13 @@ run_test("set_up", ({mock_template}) => {
|
|||
})
|
||||
.filter(Boolean);
|
||||
if (opts.user_group) {
|
||||
expected_result = expected_result.concat(groups);
|
||||
expected_result = [...expected_result, ...groups];
|
||||
}
|
||||
if (opts.user) {
|
||||
if (opts.user_source) {
|
||||
expected_result = expected_result.concat(opts.user_source());
|
||||
expected_result = [...expected_result, ...opts.user_source()];
|
||||
} else {
|
||||
expected_result = expected_result.concat(persons);
|
||||
expected_result = [...expected_result, ...persons];
|
||||
}
|
||||
}
|
||||
expected_result = expected_result
|
||||
|
|
|
@ -411,7 +411,7 @@ test("test_filter_all", ({mock_template}) => {
|
|||
{last_msg_id: 1, participated: true, type: "stream"},
|
||||
];
|
||||
|
||||
row_data = row_data.concat(generate_topic_data([[1, "topic-7", 1, true, true]]));
|
||||
row_data = [...row_data, ...generate_topic_data([[1, "topic-7", 1, true, true]])];
|
||||
i = row_data.length;
|
||||
// topic is muted (=== hidden)
|
||||
stub_out_filter_buttons();
|
||||
|
@ -754,7 +754,7 @@ test("basic assertions", ({mock_template, override_rewire}) => {
|
|||
// total 8 topics, 1 muted
|
||||
assert.equal(all_topics.size, 8);
|
||||
assert.equal(
|
||||
Array.from(all_topics.keys()).toString(),
|
||||
[...all_topics.keys()].toString(),
|
||||
"4:topic-10,1:topic-7,1:topic-6,1:topic-5,1:topic-4,1:topic-3,1:topic-2,1:topic-1",
|
||||
);
|
||||
|
||||
|
@ -766,7 +766,7 @@ test("basic assertions", ({mock_template, override_rewire}) => {
|
|||
all_topics = rt_data.get();
|
||||
assert.equal(all_topics.size, 9);
|
||||
assert.equal(
|
||||
Array.from(all_topics.keys()).toString(),
|
||||
[...all_topics.keys()].toString(),
|
||||
"4:topic-10,1:topic-7,1:topic-6,1:topic-5,1:topic-4,1:topic-3,1:topic-2,1:topic-1,6,7,8",
|
||||
);
|
||||
|
||||
|
@ -790,7 +790,7 @@ test("basic assertions", ({mock_template, override_rewire}) => {
|
|||
|
||||
all_topics = rt_data.get();
|
||||
assert.equal(
|
||||
Array.from(all_topics.keys()).toString(),
|
||||
[...all_topics.keys()].toString(),
|
||||
"1:topic-3,4:topic-10,1:topic-7,1:topic-6,1:topic-5,1:topic-4,1:topic-2,1:topic-1,6,7,8",
|
||||
);
|
||||
verify_topic_data(all_topics, stream1, topic3, id, true);
|
||||
|
@ -807,7 +807,7 @@ test("basic assertions", ({mock_template, override_rewire}) => {
|
|||
|
||||
all_topics = rt_data.get();
|
||||
assert.equal(
|
||||
Array.from(all_topics.keys()).toString(),
|
||||
[...all_topics.keys()].toString(),
|
||||
"1:topic-7,1:topic-3,4:topic-10,1:topic-6,1:topic-5,1:topic-4,1:topic-2,1:topic-1,6,7,8",
|
||||
);
|
||||
|
||||
|
@ -885,14 +885,14 @@ test("test_delete_messages", ({override}) => {
|
|||
|
||||
let all_topics = rt_data.get();
|
||||
assert.equal(
|
||||
Array.from(all_topics.keys()).toString(),
|
||||
[...all_topics.keys()].toString(),
|
||||
"4:topic-10,1:topic-7,1:topic-6,1:topic-5,1:topic-4,1:topic-3,1:topic-2,1:topic-1",
|
||||
);
|
||||
rt.update_topics_of_deleted_message_ids([messages[0].id]);
|
||||
|
||||
all_topics = rt_data.get();
|
||||
assert.equal(
|
||||
Array.from(all_topics.keys()).toString(),
|
||||
[...all_topics.keys()].toString(),
|
||||
"4:topic-10,1:topic-7,1:topic-6,1:topic-5,1:topic-4,1:topic-3,1:topic-2",
|
||||
);
|
||||
|
||||
|
@ -903,7 +903,7 @@ test("test_delete_messages", ({override}) => {
|
|||
|
||||
all_topics = rt_data.get();
|
||||
assert.equal(
|
||||
Array.from(all_topics.keys()).toString(),
|
||||
[...all_topics.keys()].toString(),
|
||||
"4:topic-10,1:topic-7,1:topic-6,1:topic-5,1:topic-4,1:topic-3",
|
||||
);
|
||||
// test deleting a message which is not locally
|
||||
|
@ -923,7 +923,7 @@ test("test_topic_edit", ({override}) => {
|
|||
|
||||
let all_topics = rt_data.get();
|
||||
assert.equal(
|
||||
Array.from(all_topics.keys()).toString(),
|
||||
[...all_topics.keys()].toString(),
|
||||
"4:topic-10,1:topic-7,1:topic-6,1:topic-5,1:topic-4,1:topic-3,1:topic-2,1:topic-1",
|
||||
);
|
||||
|
||||
|
|
|
@ -332,9 +332,7 @@ function test_sync_realm_settings() {
|
|||
settings_config.common_policy_values.by_members.code;
|
||||
$property_elem.val(settings_config.common_policy_values.by_members.code);
|
||||
|
||||
for (const policy_value of Array.from(
|
||||
Object.values(settings_config.common_policy_values),
|
||||
)) {
|
||||
for (const policy_value of Object.values(settings_config.common_policy_values)) {
|
||||
page_params[`realm_${property_name}`] = policy_value.code;
|
||||
settings_org.sync_realm_settings(property_name);
|
||||
assert.equal($property_elem.val(), policy_value.code);
|
||||
|
|
|
@ -156,7 +156,7 @@ test_ui("populate_user_groups", ({mock_template}) => {
|
|||
assert.ok(!all_pills.has(id));
|
||||
all_pills.set(id, item);
|
||||
};
|
||||
pills.items = () => Array.from(all_pills.values());
|
||||
pills.items = () => [...all_pills.values()];
|
||||
|
||||
let text_cleared;
|
||||
pills.clear_text = () => {
|
||||
|
|
|
@ -420,7 +420,7 @@ test("sort_recipients all mention", () => {
|
|||
assert.equal(all_obj.idx, 0);
|
||||
|
||||
// Test person email is "all" or "everyone"
|
||||
const test_objs = matches.concat([all_obj]);
|
||||
const test_objs = [...matches, all_obj];
|
||||
|
||||
const results = th.sort_recipients({
|
||||
users: test_objs,
|
||||
|
@ -482,7 +482,7 @@ test("sort_recipients pm counts", () => {
|
|||
});
|
||||
|
||||
test("sort_recipients dup bots", () => {
|
||||
const dup_objects = matches.concat([a_bot]);
|
||||
const dup_objects = [...matches, a_bot];
|
||||
|
||||
const recipients = th.sort_recipients({
|
||||
users: dup_objects,
|
||||
|
@ -583,7 +583,7 @@ test("sort broadcast mentions for stream message type", () => {
|
|||
// Reverse the list to test actual sorting
|
||||
// and ensure test coverage for the defensive
|
||||
// code. Also, add in some people users.
|
||||
const test_objs = Array.from(ct.broadcast_mentions()).reverse();
|
||||
const test_objs = [...ct.broadcast_mentions()].reverse();
|
||||
test_objs.unshift(zman);
|
||||
test_objs.push(a_user);
|
||||
|
||||
|
@ -604,7 +604,7 @@ test("sort broadcast mentions for private message type", () => {
|
|||
["all", "everyone"],
|
||||
);
|
||||
|
||||
const test_objs = Array.from(ct.broadcast_mentions()).reverse();
|
||||
const test_objs = [...ct.broadcast_mentions()].reverse();
|
||||
test_objs.unshift(zman);
|
||||
test_objs.push(a_user);
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ test("activate", ({override}) => {
|
|||
override(narrow_state, "active", () => narrow_active);
|
||||
|
||||
const opts = {
|
||||
events: events.slice(),
|
||||
events: [...events],
|
||||
extra_data: "",
|
||||
message: {
|
||||
id: 2001,
|
||||
|
|
Loading…
Reference in New Issue