mirror of https://github.com/zulip/zulip.git
js: Convert _.chain to array methods.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
parent
1fd4762063
commit
aa7df21265
|
@ -386,10 +386,9 @@ class Filter {
|
|||
}
|
||||
|
||||
operands(operator) {
|
||||
return _.chain(this._operators)
|
||||
return this._operators
|
||||
.filter((elem) => !elem.negated && elem.operator === operator)
|
||||
.map((elem) => elem.operand)
|
||||
.value();
|
||||
.map((elem) => elem.operand);
|
||||
}
|
||||
|
||||
has_negated_operand(operator, operand) {
|
||||
|
|
|
@ -60,7 +60,7 @@ function get_display_name(contributor) {
|
|||
// - Display full name instead of GitHub username.
|
||||
export default function render_tabs() {
|
||||
const template = _.template($("#contributors-template").html());
|
||||
const total_tab_html = _.chain(contributors_list)
|
||||
const total_tab_html = contributors_list
|
||||
.map((c) => ({
|
||||
name: get_display_name(c),
|
||||
github_username: c.github_username,
|
||||
|
@ -68,10 +68,8 @@ export default function render_tabs() {
|
|||
profile_url: get_profile_url(c),
|
||||
commits: calculate_total_commits(c),
|
||||
}))
|
||||
.sortBy("commits")
|
||||
.reverse()
|
||||
.sort((a, b) => (a.commits < b.commits ? 1 : a.commits > b.commits ? -1 : 0))
|
||||
.map((c) => template(c))
|
||||
.value()
|
||||
.join("");
|
||||
|
||||
$("#tab-total").html(total_tab_html);
|
||||
|
@ -86,10 +84,11 @@ export default function render_tabs() {
|
|||
|
||||
$("#" + tab_name).on("click", () => {
|
||||
if (!loaded_repos.includes(repo_name)) {
|
||||
const html = _.chain(contributors_list)
|
||||
.filter(repo_name)
|
||||
.sortBy(repo_name)
|
||||
.reverse()
|
||||
const html = contributors_list
|
||||
.filter((c) => c[repo_name])
|
||||
.sort((a, b) =>
|
||||
a[repo_name] < b[repo_name] ? 1 : a[repo_name] > b[repo_name] ? -1 : 0,
|
||||
)
|
||||
.map((c) =>
|
||||
template({
|
||||
name: get_display_name(c),
|
||||
|
@ -99,7 +98,6 @@ export default function render_tabs() {
|
|||
commits: c[repo_name],
|
||||
}),
|
||||
)
|
||||
.value()
|
||||
.join("");
|
||||
|
||||
$("#tab-" + tab_name).html(html);
|
||||
|
|
|
@ -231,7 +231,10 @@ exports.initialize_kitchen_sink_stuff = function () {
|
|||
selected_id_from_idx: messages[event.msg_list.selected_idx()].id,
|
||||
msg_list_sorted: _.isEqual(
|
||||
messages.map((message) => message.id),
|
||||
_.chain(current_msg_list.all_messages()).pluck("id").clone().value().sort(),
|
||||
current_msg_list
|
||||
.all_messages()
|
||||
.map((message) => message.id)
|
||||
.sort(),
|
||||
),
|
||||
found_in_dom: row_from_dom.length,
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue