Commit 969f902d authored by JC Brand's avatar JC Brand

Playing around with removing more lodash calls

parent ba6de884
......@@ -23,7 +23,7 @@
"ignoreMethods": [
"assign", "every", "keys", "find", "endsWith", "startsWith", "filter",
"reduce", "isArray", "create", "map", "replace", "some", "toLower",
"split", "trim", "forEach", "toUpperCase", "includes"
"split", "trim", "forEach", "toUpperCase", "includes", "values"
]
}],
"lodash/prefer-invoke-map": "off",
......
......@@ -59849,8 +59849,6 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_4__["default"].plugins
},
render() {
const that = this;
if (!this.mayBeShown()) {
u.hideElement(this.el);
return this;
......@@ -59861,13 +59859,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_4__["default"].plugins
requesting = this.model.get('requesting'),
subscription = this.model.get('subscription');
const classes_to_remove = ['current-xmpp-contact', 'pending-xmpp-contact', 'requesting-xmpp-contact'].concat(Object.keys(STATUSES));
_.each(classes_to_remove, function (cls) {
if (_.includes(that.el.className, cls)) {
that.el.classList.remove(cls);
}
});
classes_to_remove.forEach(c => u.removeClass(c, this.el));
this.el.classList.add(show);
this.el.setAttribute('data-status', show);
this.highlight();
......@@ -60090,11 +60082,9 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_4__["default"].plugins
show() {
u.showElement(this.el);
_.each(this.getAll(), contact_view => {
if (contact_view.mayBeShown() && this.model.get('state') === _converse.OPENED) {
u.showElement(contact_view.el);
if (this.model.get('state') === _converse.OPENED) {
Object.values(this.getAll()).filter(v => v.mayBeShown()).forEach(v => u.showElement(v.el));
}
});
return this;
},
......@@ -402,7 +402,6 @@ converse.plugins.add('converse-rosterview', {
},
render () {
const that = this;
if (!this.mayBeShown()) {
u.hideElement(this.el);
return this;
......@@ -417,13 +416,8 @@ converse.plugins.add('converse-rosterview', {
'pending-xmpp-contact',
'requesting-xmpp-contact'
].concat(Object.keys(STATUSES));
classes_to_remove.forEach(c => u.removeClass(c, this.el));
_.each(classes_to_remove,
function (cls) {
if (_.includes(that.el.className, cls)) {
that.el.classList.remove(cls);
}
});
this.el.classList.add(show);
this.el.setAttribute('data-status', show);
this.highlight();
......@@ -634,11 +628,11 @@ converse.plugins.add('converse-rosterview', {
show () {
u.showElement(this.el);
_.each(this.getAll(), (contact_view) => {
if (contact_view.mayBeShown() && this.model.get('state') === _converse.OPENED) {
u.showElement(contact_view.el);
if (this.model.get('state') === _converse.OPENED) {
Object.values(this.getAll())
.filter(v => v.mayBeShown())
.forEach(v => u.showElement(v.el));
}
});
return this;
},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment