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

Playing around with removing more lodash calls

parent ba6de884
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
"ignoreMethods": [ "ignoreMethods": [
"assign", "every", "keys", "find", "endsWith", "startsWith", "filter", "assign", "every", "keys", "find", "endsWith", "startsWith", "filter",
"reduce", "isArray", "create", "map", "replace", "some", "toLower", "reduce", "isArray", "create", "map", "replace", "some", "toLower",
"split", "trim", "forEach", "toUpperCase", "includes" "split", "trim", "forEach", "toUpperCase", "includes", "values"
] ]
}], }],
"lodash/prefer-invoke-map": "off", "lodash/prefer-invoke-map": "off",
......
...@@ -59849,8 +59849,6 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_4__["default"].plugins ...@@ -59849,8 +59849,6 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_4__["default"].plugins
}, },
render() { render() {
const that = this;
if (!this.mayBeShown()) { if (!this.mayBeShown()) {
u.hideElement(this.el); u.hideElement(this.el);
return this; return this;
...@@ -59861,13 +59859,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_4__["default"].plugins ...@@ -59861,13 +59859,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_4__["default"].plugins
requesting = this.model.get('requesting'), requesting = this.model.get('requesting'),
subscription = this.model.get('subscription'); subscription = this.model.get('subscription');
const classes_to_remove = ['current-xmpp-contact', 'pending-xmpp-contact', 'requesting-xmpp-contact'].concat(Object.keys(STATUSES)); const classes_to_remove = ['current-xmpp-contact', '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.classList.add(show);
this.el.setAttribute('data-status', show); this.el.setAttribute('data-status', show);
this.highlight(); this.highlight();
...@@ -60090,11 +60082,9 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_4__["default"].plugins ...@@ -60090,11 +60082,9 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_4__["default"].plugins
show() { show() {
u.showElement(this.el); u.showElement(this.el);
_.each(this.getAll(), contact_view => { if (this.model.get('state') === _converse.OPENED) {
if (contact_view.mayBeShown() && this.model.get('state') === _converse.OPENED) { Object.values(this.getAll()).filter(v => v.mayBeShown()).forEach(v => u.showElement(v.el));
u.showElement(contact_view.el); }
}
});
return this; return this;
}, },
...@@ -402,7 +402,6 @@ converse.plugins.add('converse-rosterview', { ...@@ -402,7 +402,6 @@ converse.plugins.add('converse-rosterview', {
}, },
render () { render () {
const that = this;
if (!this.mayBeShown()) { if (!this.mayBeShown()) {
u.hideElement(this.el); u.hideElement(this.el);
return this; return this;
...@@ -417,13 +416,8 @@ converse.plugins.add('converse-rosterview', { ...@@ -417,13 +416,8 @@ converse.plugins.add('converse-rosterview', {
'pending-xmpp-contact', 'pending-xmpp-contact',
'requesting-xmpp-contact' 'requesting-xmpp-contact'
].concat(Object.keys(STATUSES)); ].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.classList.add(show);
this.el.setAttribute('data-status', show); this.el.setAttribute('data-status', show);
this.highlight(); this.highlight();
...@@ -634,11 +628,11 @@ converse.plugins.add('converse-rosterview', { ...@@ -634,11 +628,11 @@ converse.plugins.add('converse-rosterview', {
show () { show () {
u.showElement(this.el); u.showElement(this.el);
_.each(this.getAll(), (contact_view) => { if (this.model.get('state') === _converse.OPENED) {
if (contact_view.mayBeShown() && this.model.get('state') === _converse.OPENED) { Object.values(this.getAll())
u.showElement(contact_view.el); .filter(v => v.mayBeShown())
} .forEach(v => u.showElement(v.el));
}); }
return this; 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