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 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_')) {