mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 06:53:25 +00:00
js: Convert _.uniq(a) to Array.from(new Set(a)).
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
committed by
Tim Abbott
parent
2fc156e556
commit
e2290ef0de
@@ -22,7 +22,7 @@ function make_tab(i) {
|
|||||||
self.addClass = (c) => {
|
self.addClass = (c) => {
|
||||||
self.class += " " + c;
|
self.class += " " + c;
|
||||||
const tokens = self.class.trim().split(/ +/);
|
const tokens = self.class.trim().split(/ +/);
|
||||||
self.class = _.uniq(tokens).join(" ");
|
self.class = Array.from(new Set(tokens)).join(" ");
|
||||||
};
|
};
|
||||||
|
|
||||||
self.removeClass = (c) => {
|
self.removeClass = (c) => {
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
import _ from "lodash";
|
|
||||||
|
|
||||||
import * as muted_users from "./muted_users";
|
import * as muted_users from "./muted_users";
|
||||||
import * as util from "./util";
|
import * as util from "./util";
|
||||||
|
|
||||||
@@ -56,7 +54,6 @@ export function get_group_typists(group) {
|
|||||||
export function get_all_typists() {
|
export function get_all_typists() {
|
||||||
let typists = Array.from(typist_dct.values()).flat();
|
let typists = Array.from(typist_dct.values()).flat();
|
||||||
typists = util.sorted_ids(typists);
|
typists = util.sorted_ids(typists);
|
||||||
typists = _.sortedUniq(typists);
|
|
||||||
return muted_users.filter_muted_user_ids(typists);
|
return muted_users.filter_muted_user_ids(typists);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
import _ from "lodash";
|
|
||||||
|
|
||||||
import {$t} from "./i18n";
|
import {$t} from "./i18n";
|
||||||
|
|
||||||
// From MDN: https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/random
|
// From MDN: https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/random
|
||||||
@@ -202,8 +200,8 @@ export function sorted_ids(ids) {
|
|||||||
// This mapping makes sure we are using ints, and
|
// This mapping makes sure we are using ints, and
|
||||||
// it also makes sure we don't mutate the list.
|
// it also makes sure we don't mutate the list.
|
||||||
let id_list = ids.map((s) => Number.parseInt(s, 10));
|
let id_list = ids.map((s) => Number.parseInt(s, 10));
|
||||||
|
id_list = Array.from(new Set(id_list));
|
||||||
id_list.sort((a, b) => a - b);
|
id_list.sort((a, b) => a - b);
|
||||||
id_list = _.sortedUniq(id_list);
|
|
||||||
|
|
||||||
return id_list;
|
return id_list;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user