From 22170450b4cda7c57731183bbba5d36cad9c0593 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Thu, 11 Aug 2022 10:30:07 +0200 Subject: [PATCH] Stop using `zipObject` from lodash --- src/headless/plugins/muc/muc.js | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/headless/plugins/muc/muc.js b/src/headless/plugins/muc/muc.js index 51f1fe608..4caaf65c4 100644 --- a/src/headless/plugins/muc/muc.js +++ b/src/headless/plugins/muc/muc.js @@ -6,7 +6,6 @@ import p from '../../utils/parse-helpers'; import pick from 'lodash-es/pick'; import sizzle from 'sizzle'; import u from '../../utils/form'; -import zipObject from 'lodash-es/zipObject'; import { Model } from '@converse/skeletor/src/model.js'; import { Strophe, $build, $iq, $msg, $pres } from 'strophe.js/src/strophe'; import { _converse, api, converse } from '../../core.js'; @@ -381,10 +380,10 @@ const ChatRoomMixin = { this.features = new Model( Object.assign( { id }, - zipObject( - converse.ROOM_FEATURES, - converse.ROOM_FEATURES.map(() => false) - ) + converse.ROOM_FEATURES.reduce((acc, feature) => { + acc[feature] = false; + return acc; + }, {}) ) ); this.features.browserStorage = _converse.createStore(id, 'session'); @@ -1168,13 +1167,12 @@ const ChatRoomMixin = { */ async getDiscoInfoFeatures () { const features = await api.disco.getFeatures(this.get('jid')); - const attrs = Object.assign( - zipObject( - converse.ROOM_FEATURES, - converse.ROOM_FEATURES.map(() => false) - ), - { 'fetched': new Date().toISOString() } - ); + + const attrs = converse.ROOM_FEATURES.reduce((acc, feature) => { + acc[feature] = false; + return acc; + }, { 'fetched': new Date().toISOString() }); + features.each(feature => { const fieldname = feature.get('var'); if (!fieldname.startsWith('muc_')) {