Stop using zipObject from lodash

This commit is contained in:
JC Brand 2022-08-11 10:30:07 +02:00
parent f014db8b7a
commit 22170450b4

View File

@ -6,7 +6,6 @@ import p from '../../utils/parse-helpers';
import pick from 'lodash-es/pick'; import pick from 'lodash-es/pick';
import sizzle from 'sizzle'; import sizzle from 'sizzle';
import u from '../../utils/form'; import u from '../../utils/form';
import zipObject from 'lodash-es/zipObject';
import { Model } from '@converse/skeletor/src/model.js'; import { Model } from '@converse/skeletor/src/model.js';
import { Strophe, $build, $iq, $msg, $pres } from 'strophe.js/src/strophe'; import { Strophe, $build, $iq, $msg, $pres } from 'strophe.js/src/strophe';
import { _converse, api, converse } from '../../core.js'; import { _converse, api, converse } from '../../core.js';
@ -381,10 +380,10 @@ const ChatRoomMixin = {
this.features = new Model( this.features = new Model(
Object.assign( Object.assign(
{ id }, { id },
zipObject( converse.ROOM_FEATURES.reduce((acc, feature) => {
converse.ROOM_FEATURES, acc[feature] = false;
converse.ROOM_FEATURES.map(() => false) return acc;
) }, {})
) )
); );
this.features.browserStorage = _converse.createStore(id, 'session'); this.features.browserStorage = _converse.createStore(id, 'session');
@ -1168,13 +1167,12 @@ const ChatRoomMixin = {
*/ */
async getDiscoInfoFeatures () { async getDiscoInfoFeatures () {
const features = await api.disco.getFeatures(this.get('jid')); const features = await api.disco.getFeatures(this.get('jid'));
const attrs = Object.assign(
zipObject( const attrs = converse.ROOM_FEATURES.reduce((acc, feature) => {
converse.ROOM_FEATURES, acc[feature] = false;
converse.ROOM_FEATURES.map(() => false) return acc;
), }, { 'fetched': new Date().toISOString() });
{ 'fetched': new Date().toISOString() }
);
features.each(feature => { features.each(feature => {
const fieldname = feature.get('var'); const fieldname = feature.get('var');
if (!fieldname.startsWith('muc_')) { if (!fieldname.startsWith('muc_')) {