Commit 34469425 authored by JC Brand's avatar JC Brand

Use Object.assign instead of _.extend

parent 51d0dc8d
......@@ -21,9 +21,9 @@
"rules": {
"lodash/prefer-lodash-method": [2, {
"ignoreMethods": [
"every", "keys", "find", "endsWith", "startsWith", "filter", "reduce", "isArray",
"create", "map", "replace", "some", "toLower", "split", "trim", "forEach",
"toUpperCase", "includes"
"assign", "every", "keys", "find", "endsWith", "startsWith", "filter",
"reduce", "isArray", "create", "map", "replace", "some", "toLower",
"split", "trim", "forEach", "toUpperCase", "includes"
]
}],
"lodash/prefer-invoke-map": "off",
......
This diff is collapsed.
......@@ -370,7 +370,7 @@ converse.plugins.add("converse-autocomplete", {
}
// Make it an event emitter
_.extend(AutoComplete.prototype, Backbone.Events);
Object.assign(AutoComplete.prototype, Backbone.Events);
const helpers = {
......
......@@ -190,7 +190,7 @@ converse.plugins.add('converse-bookmarks', {
_converse.api.promises.add('bookmarksInitialized');
// Pure functions on the _converse object
_.extend(_converse, {
Object.assign(_converse, {
removeBookmarkViaEvent (ev) {
/* Remove a bookmark as determined by the passed in
* event.
......
......@@ -102,7 +102,7 @@ converse.plugins.add('converse-chatview', {
toHTML () {
return tpl_emojis(
_.extend(
Object.assign(
this.model.toJSON(), {
'_': _,
'transform': u.getEmojiRenderer(_converse),
......@@ -176,7 +176,7 @@ converse.plugins.add('converse-chatview', {
const vcard = _.get(this.model, 'vcard'),
vcard_json = vcard ? vcard.toJSON() : {};
this.el.innerHTML = tpl_chatbox_head(
_.extend(
Object.assign(
vcard_json,
this.model.toJSON(),
{ '_converse': _converse,
......@@ -232,7 +232,7 @@ converse.plugins.add('converse-chatview', {
toHTML () {
const vcard = _.get(this.model, 'vcard'),
vcard_json = vcard ? vcard.toJSON() : {};
return tpl_user_details_modal(_.extend(
return tpl_user_details_modal(Object.assign(
this.model.toJSON(),
vcard_json, {
'_': _,
......@@ -369,7 +369,7 @@ converse.plugins.add('converse-chatview', {
// XXX: Is this still needed?
this.el.setAttribute('id', this.model.get('box_id'));
this.el.innerHTML = tpl_chatbox(
_.extend(this.model.toJSON(), {
Object.assign(this.model.toJSON(), {
'unread_msgs': __('You have unread messages')
}
));
......@@ -410,7 +410,7 @@ converse.plugins.add('converse-chatview', {
}
const form_container = this.el.querySelector('.bottom-panel');
form_container.innerHTML = tpl_chatbox_message_form(
_.extend(this.model.toJSON(), {
Object.assign(this.model.toJSON(), {
'hint_value': _.get(this.el.querySelector('.spoiler-hint'), 'value'),
'label_message': placeholder,
'label_send': __('Send'),
......@@ -516,7 +516,7 @@ converse.plugins.add('converse-chatview', {
} else {
label_toggle_spoiler = __('Click to write your message as a spoiler');
}
return _.extend(options || {}, {
return Object.assign(options || {}, {
'label_clear': __('Clear all messages'),
'tooltip_insert_smiley': __('Insert emojis'),
'tooltip_start_call': __('Start a call'),
......@@ -1400,7 +1400,7 @@ converse.plugins.add('converse-chatview', {
});
/************************ BEGIN API ************************/
_.extend(_converse.api, {
Object.assign(_converse.api, {
/**
* The "chatview" namespace groups methods pertaining to views
* for one-on-one chats.
......
......@@ -244,7 +244,7 @@ converse.plugins.add('converse-controlbox', {
this.model.set('closed', !_converse.show_controlbox_by_default);
}
}
this.el.innerHTML = tpl_controlbox(_.extend(this.model.toJSON()));
this.el.innerHTML = tpl_controlbox(Object.assign(this.model.toJSON()));
if (!this.model.get('closed')) {
this.show();
......@@ -416,7 +416,7 @@ converse.plugins.add('converse-controlbox', {
feedback_class = CONNECTION_STATUS_CSS_CLASS[pretty_status];
}
return tpl_login_panel(
_.extend(this.model.toJSON(), {
Object.assign(this.model.toJSON(), {
'__': __,
'_converse': _converse,
'ANONYMOUS': _converse.ANONYMOUS,
......@@ -658,7 +658,7 @@ converse.plugins.add('converse-controlbox', {
/************************ BEGIN API ************************/
_.extend(_converse.api, {
Object.assign(_converse.api, {
/**
* The "controlbox" namespace groups methods pertaining to the
* controlbox view
......
......@@ -96,7 +96,7 @@ converse.plugins.add('converse-headline', {
render () {
this.el.setAttribute('id', this.model.get('box_id'))
this.el.innerHTML = tpl_chatbox(
_.extend(this.model.toJSON(), {
Object.assign(this.model.toJSON(), {
info_close: '',
label_personal_message: '',
show_send_button: false,
......
......@@ -101,7 +101,7 @@ converse.plugins.add('converse-mam-views', {
}
this.addSpinner();
_converse.api.archive.query(
_.extend({
Object.assign({
'groupchat': is_groupchat,
'before': '', // Page backwards from the most recent message
'max': _converse.archived_messages_page_size,
......
......@@ -67,7 +67,7 @@ converse.plugins.add('converse-message-view', {
_converse.MessageVersionsModal = _converse.BootstrapModal.extend({
toHTML () {
return tpl_message_versions_modal(_.extend(
return tpl_message_versions_modal(Object.assign(
this.model.toJSON(), {
'__': __
}));
......@@ -154,7 +154,7 @@ converse.plugins.add('converse-message-view', {
roles = role ? role.split(',') : [];
const msg = u.stringToElement(tpl_message(
_.extend(
Object.assign(
this.model.toJSON(), {
'__': __,
'is_me_message': is_me_message,
......@@ -203,7 +203,7 @@ converse.plugins.add('converse-message-view', {
renderErrorMessage () {
const moment_time = moment(this.model.get('time')),
msg = u.stringToElement(
tpl_info(_.extend(this.model.toJSON(), {
tpl_info(Object.assign(this.model.toJSON(), {
'extra_classes': 'chat-error',
'isodate': moment_time.format()
})));
......@@ -244,7 +244,7 @@ converse.plugins.add('converse-message-view', {
renderFileUploadProgresBar () {
const msg = u.stringToElement(tpl_file_progress(
_.extend(this.model.toJSON(), {
Object.assign(this.model.toJSON(), {
'__': __,
'filename': this.model.file.name,
'filesize': filesize(this.model.file.size)
......
......@@ -348,7 +348,7 @@ converse.plugins.add('converse-minimize', {
},
render () {
const data = _.extend(
const data = Object.assign(
this.model.toJSON(),
{ 'tooltip': __('Click to restore this chat') }
);
......@@ -510,7 +510,7 @@ converse.plugins.add('converse-minimize', {
render () {
this.el.innerHTML = tpl_toggle_chats(
_.extend(this.model.toJSON(), {
Object.assign(this.model.toJSON(), {
'Minimized': __('Minimized')
})
);
......
......@@ -75,7 +75,7 @@ converse.plugins.add('converse-modal', {
// We extend the default converse.js API to add methods specific to MUC chat rooms.
let alert
_.extend(_converse.api, {
Object.assign(_converse.api, {
'alert': {
'show' (type, title, messages) {
if (_.isString(messages)) {
......
......@@ -289,7 +289,7 @@ converse.plugins.add('converse-muc-views', {
toHTML () {
const muc_domain = this.model.get('muc_domain') || _converse.muc_domain;
return tpl_list_chatrooms_modal(_.extend(this.model.toJSON(), {
return tpl_list_chatrooms_modal(Object.assign(this.model.toJSON(), {
'heading_list_chatrooms': __('Query for Groupchats'),
'label_server_address': __('Server address'),
'label_query': __('Show groupchats'),
......@@ -420,7 +420,7 @@ converse.plugins.add('converse-muc-views', {
const muc_domain = this.model.get('muc_domain') || _converse.muc_domain;
placeholder = muc_domain ? `name@${muc_domain}` : __('name@conference.example.org');
}
return tpl_add_chatroom_modal(_.extend(this.model.toJSON(), {
return tpl_add_chatroom_modal(Object.assign(this.model.toJSON(), {
'__': _converse.__,
'_converse': _converse,
'label_room_address': _converse.muc_domain ? __('Groupchat name') : __('Groupchat address'),
......@@ -466,7 +466,7 @@ converse.plugins.add('converse-muc-views', {
jid = data.jid
this.model.setDomain(jid);
}
_converse.api.rooms.open(jid, _.extend(data, {jid}));
_converse.api.rooms.open(jid, Object.assign(data, {jid}));
this.modal.hide();
ev.target.reset();
}
......@@ -483,7 +483,7 @@ converse.plugins.add('converse-muc-views', {
},
toHTML () {
return tpl_chatroom_details_modal(_.extend(
return tpl_chatroom_details_modal(Object.assign(
this.model.toJSON(), {
'_': _,
'__': __,
......@@ -728,7 +728,7 @@ converse.plugins.add('converse-muc-views', {
/* Returns the heading HTML to be rendered.
*/
return tpl_chatroom_head(
_.extend(this.model.toJSON(), {
Object.assign(this.model.toJSON(), {
'_converse': _converse,
'Strophe': Strophe,
'info_close': __('Close and leave this groupchat'),
......@@ -774,7 +774,7 @@ converse.plugins.add('converse-muc-views', {
},
getToolbarOptions () {
return _.extend(
return Object.assign(
_converse.ChatBoxView.prototype.getToolbarOptions.apply(this, arguments),
{
'label_hide_occupants': __('Hide the list of participants'),
......@@ -1989,7 +1989,7 @@ converse.plugins.add('converse-muc-views', {
toHTML () {
const show = this.model.get('show');
return tpl_occupant(
_.extend(
Object.assign(
{ '_': _,
'jid': '',
'show': show,
......@@ -2040,7 +2040,7 @@ converse.plugins.add('converse-muc-views', {
render () {
this.el.innerHTML = tpl_chatroom_sidebar(
_.extend(this.chatroomview.model.toJSON(), {
Object.assign(this.chatroomview.model.toJSON(), {
'allow_muc_invitations': _converse.allow_muc_invitations,
'label_occupants': __('Participants')
})
......@@ -2078,7 +2078,7 @@ converse.plugins.add('converse-muc-views', {
if (_.reduce(_.values(picks), iteratee)) {
const el = this.el.querySelector('.chatroom-features');
el.innerHTML = tpl_chatroom_features(_.extend(features.toJSON(), {__}));
el.innerHTML = tpl_chatroom_features(Object.assign(features.toJSON(), {__}));
this.setOccupantsHeight();
}
return this;
......@@ -2253,7 +2253,7 @@ converse.plugins.add('converse-muc-views', {
/************************ BEGIN API ************************/
_.extend(_converse.api, {
Object.assign(_converse.api, {
/**
* The "roomviews" namespace groups methods relevant to chatroom
* (aka groupchats) views.
......
......@@ -82,7 +82,7 @@ converse.plugins.add("converse-oauth", {
initialize () {
_.each(_converse.user_settings.oauth_providers, (provider) => {
const item = new Backbone.Model(_.extend(provider, {
const item = new Backbone.Model(Object.assign(provider, {
'login_text': __('Log in with %1$s', provider.name)
}));
this.add(item, {'silent': true});
......@@ -99,7 +99,7 @@ converse.plugins.add("converse-oauth", {
toHTML () {
return tpl_oauth_providers(
_.extend({
Object.assign({
'_': _,
'__': _converse.__,
'providers': this.model.toJSON()
......
......@@ -242,7 +242,7 @@ converse.plugins.add('converse-omemo', {
if (encrypted.payload) {
const key = key_and_tag.slice(0, 16),
tag = key_and_tag.slice(16);
const result = await this.decryptMessage(_.extend(encrypted, {'key': key, 'tag': tag}));
const result = await this.decryptMessage(Object.assign(encrypted, {'key': key, 'tag': tag}));
device.save('active', true);
return result;
}
......@@ -263,9 +263,9 @@ converse.plugins.add('converse-omemo', {
}).then(() => _converse.omemo_store.publishBundle())
.then(() => {
if (plaintext) {
return _.extend(attrs, {'plaintext': plaintext});
return Object.assign(attrs, {'plaintext': plaintext});
} else {
return _.extend(attrs, {'is_only_key': true});
return Object.assign(attrs, {'is_only_key': true});
}
}).catch(e => {
this.reportDecryptionError(e);
......@@ -274,7 +274,7 @@ converse.plugins.add('converse-omemo', {
} else {
return session_cipher.decryptWhisperMessage(u.base64ToArrayBuffer(attrs.encrypted.key), 'binary')
.then(key_and_tag => this.handleDecryptedWhisperMessage(attrs, key_and_tag))
.then(plaintext => _.extend(attrs, {'plaintext': plaintext}))
.then(plaintext => Object.assign(attrs, {'plaintext': plaintext}))
.catch(e => {
this.reportDecryptionError(e);
return attrs;
......@@ -407,7 +407,7 @@ converse.plugins.add('converse-omemo', {
const { _converse } = this.__super__,
{ __ } = _converse,
icon = this.el.querySelector('.toggle-omemo'),
html = tpl_toolbar_omemo(_.extend(this.model.toJSON(), {'__': __}));
html = tpl_toolbar_omemo(Object.assign(this.model.toJSON(), {'__': __}));
if (icon) {
icon.outerHTML = html;
......@@ -727,7 +727,7 @@ converse.plugins.add('converse-omemo', {
'pubKey': u.arrayBufferToBase64(key_pair.pubKey),
'privKey': u.arrayBufferToBase64(key_pair.privKey)
}
this.save('prekeys', _.extend(this.getPreKeys(), prekey));
this.save('prekeys', Object.assign(this.getPreKeys(), prekey));
return Promise.resolve();
},
......@@ -834,7 +834,7 @@ converse.plugins.add('converse-omemo', {
device = devicelist.devices.get(this.get('device_id'));
const bundle = await device.getBundle();
device.save('bundle', _.extend(bundle, {'prekeys': marshalled_keys}));
device.save('bundle', Object.assign(bundle, {'prekeys': marshalled_keys}));
},
async generateBundle () {
......@@ -1242,7 +1242,7 @@ converse.plugins.add('converse-omemo', {
});
/************************ BEGIN API ************************/
_.extend(_converse.api, {
Object.assign(_converse.api, {
/**
* The "omemo" namespace groups methods relevant to OMEMO
* encryption.
......
......@@ -58,7 +58,7 @@ converse.plugins.add('converse-profile', {
},
toHTML () {
return tpl_profile_modal(_.extend(
return tpl_profile_modal(Object.assign(
this.model.toJSON(),
this.model.vcard.toJSON(), {
'_': _,
......@@ -128,14 +128,14 @@ converse.plugins.add('converse-profile', {
'url': form_data.get('url'),
};
if (!image_file.size) {
_.extend(data, {
Object.assign(data, {
'image': this.model.vcard.get('image'),
'image_type': this.model.vcard.get('image_type')
});
this.setVCard(data);
} else {
reader.onloadend = () => {
_.extend(data, {
Object.assign(data, {
'image': btoa(reader.result),
'image_type': image_file.type
});
......@@ -155,7 +155,7 @@ converse.plugins.add('converse-profile', {
toHTML () {
return tpl_chat_status_modal(
_.extend(
Object.assign(
this.model.toJSON(),
this.model.vcard.toJSON(), {
'label_away': __('Away'),
......@@ -202,7 +202,7 @@ converse.plugins.add('converse-profile', {
toHTML () {
return tpl_client_info_modal(
_.extend(
Object.assign(
this.model.toJSON(),
this.model.vcard.toJSON(), {
'__': __,
......@@ -239,7 +239,7 @@ converse.plugins.add('converse-profile', {
toHTML () {
const chat_status = this.model.get('status') || 'offline';
return tpl_profile_view(_.extend(
return tpl_profile_view(Object.assign(
this.model.toJSON(),
this.model.vcard.toJSON(), {
'__': __,
......
......@@ -151,7 +151,7 @@ converse.plugins.add('converse-register', {
_converse.RegisterLinkView = Backbone.VDOMView.extend({
toHTML () {
return tpl_register_link(
_.extend(this.model.toJSON(), {
Object.assign(this.model.toJSON(), {
'__': _converse.__,
'_converse': _converse,
'connection_status': _converse.connfeedback.get('connection_status'),
......@@ -294,9 +294,9 @@ converse.plugins.add('converse-register', {
domain: null,
form_type: null
};
_.extend(this, defaults);
Object.assign(this, defaults);
if (settings) {
_.extend(this, _.pick(settings, _.keys(defaults)));
Object.assign(this, _.pick(settings, _.keys(defaults)));
}
},
......
......@@ -113,7 +113,7 @@ converse.plugins.add('converse-roomslist', {
toHTML () {
return tpl_rooms_list_item(
_.extend(this.model.toJSON(), {
Object.assign(this.model.toJSON(), {
// XXX: By the time this renders, the _converse.bookmarks
// collection should already exist if bookmarks are
// supported by the XMPP server. So we can use it
......
......@@ -119,7 +119,7 @@ converse.plugins.add('converse-rosterview', {
toHTML () {
const label_nickname = _converse.xhr_user_search_url ? __('Contact name') : __('Optional nickname');
return tpl_add_contact_modal(_.extend(this.model.toJSON(), {
return tpl_add_contact_modal(Object.assign(this.model.toJSON(), {
'_converse': _converse,
'heading_new_contact': __('Add a Contact'),
'label_xmpp_address': __('XMPP Address'),
......@@ -276,7 +276,7 @@ converse.plugins.add('converse-rosterview', {
toHTML () {
return tpl_roster_filter(
_.extend(this.model.toJSON(), {
Object.assign(this.model.toJSON(), {
visible: this.shouldBeVisible(),
placeholder: __('Filter'),
title_contact_filter: __('Filter by contact name'),
......@@ -454,7 +454,7 @@ converse.plugins.add('converse-rosterview', {
const display_name = this.model.getDisplayName();
this.el.classList.add('pending-xmpp-contact');
this.el.innerHTML = tpl_pending_contact(
_.extend(this.model.toJSON(), {
Object.assign(this.model.toJSON(), {
'display_name': display_name,
'desc_remove': __('Click to remove %1$s as a contact', display_name),
'allow_chat_pending_contacts': _converse.allow_chat_pending_contacts
......@@ -464,7 +464,7 @@ converse.plugins.add('converse-rosterview', {
const display_name = this.model.getDisplayName();
this.el.classList.add('requesting-xmpp-contact');
this.el.innerHTML = tpl_requesting_contact(
_.extend(this.model.toJSON(), {
Object.assign(this.model.toJSON(), {
'display_name': display_name,
'desc_accept': __("Click to accept the contact request from %1$s", display_name),
'desc_decline': __("Click to decline the contact request from %1$s", display_name),
......@@ -507,7 +507,7 @@ converse.plugins.add('converse-rosterview', {
}
const display_name = item.getDisplayName();
this.el.innerHTML = tpl_roster_item(
_.extend(item.toJSON(), {
Object.assign(item.toJSON(), {
'display_name': display_name,
'desc_status': STATUSES[show],
'status_icon': status_icon,
......
......@@ -639,7 +639,7 @@ converse.plugins.add('converse-chatboxes', {
});
} else {
const message = this.messages.create(
_.extend(
Object.assign(
this.getOutgoingMessageAttributes(), {
'file': true,
'progress': 0,
......@@ -736,7 +736,7 @@ converse.plugins.add('converse-chatboxes', {
stanza.getElementsByTagName(_converse.ACTIVE).length && _converse.ACTIVE ||
stanza.getElementsByTagName(_converse.GONE).length && _converse.GONE;
const attrs = _.extend({
const attrs = Object.assign({
'chat_state': chat_state,
'is_archived': this.isArchived(original_stanza),
'is_delayed': !_.isNil(delay),
......@@ -1030,7 +1030,7 @@ converse.plugins.add('converse-chatboxes', {
let chatbox = this.get(Strophe.getBareJidFromJid(jid));
if (!chatbox && create) {
_.extend(attrs, {'jid': jid, 'id': jid});
Object.assign(attrs, {'jid': jid, 'id': jid});
chatbox = this.create(attrs, {
'error' (model, response) {
_converse.log(response.responseText);
......@@ -1095,7 +1095,7 @@ converse.plugins.add('converse-chatboxes', {
/************************ BEGIN API ************************/
_.extend(_converse.api, {
Object.assign(_converse.api, {
/**
* The "chats" namespace (used for one-on-one chats)
*
......
......@@ -75,7 +75,7 @@ const _converse = {
_converse.VERSION_NAME = "v4.2.0";
_.extend(_converse, Backbone.Events);
Object.assign(_converse, Backbone.Events);
// Make converse pluggable
pluggable.enable(_converse, '_converse', 'pluggable');
......
......@@ -362,7 +362,7 @@ converse.plugins.add('converse-disco', {
}
_.extend(_converse.api, {
Object.assign(_converse.api, {
/**
* The XEP-0030 service discovery API
*
......
......@@ -89,7 +89,7 @@ function queryForArchivedMessages (_converse, options, callback, errback) {
let rsm;
if (!_.isUndefined(set)) {
rsm = new Strophe.RSM({xml: set});
_.extend(rsm, _.pick(options, _.concat(MAM_ATTRIBUTES, ['max'])));
Object.assign(rsm, _.pick(options, _.concat(MAM_ATTRIBUTES, ['max'])));
}
callback(messages, rsm);
}
......@@ -142,7 +142,7 @@ converse.plugins.add('converse-mam', {
getUpdatedMessageAttributes (message, stanza) {
const attrs = this.__super__.getUpdatedMessageAttributes.apply(this, arguments);
if (message && !message.get('is_archived')) {
return _.extend(attrs, {
return Object.assign(attrs, {
'is_archived': this.isArchived(stanza)
}, this.getStanzaIDs(stanza))
}
......@@ -226,7 +226,7 @@ converse.plugins.add('converse-mam', {
/************************ BEGIN API ************************/
_.extend(_converse.api, {
Object.assign(_converse.api, {
/**
* The [XEP-0313](https://xmpp.org/extensions/xep-0313.html) Message Archive Management API
*
......
......@@ -559,7 +559,7 @@ converse.plugins.add('converse-muc', {
});
const features = await _converse.api.disco.getFeatures(this.get('jid'));
const attrs = _.extend(
const attrs = Object.assign(
_.zipObject(converse.ROOM_FEATURES, _.map(converse.ROOM_FEATURES, _.stubFalse)),
{'fetched': moment().format()}
);
......@@ -921,7 +921,7 @@ converse.plugins.add('converse-muc', {
}
}
const jid = data.jid || '';
const attributes = _.extend(data, {
const attributes = Object.assign(data, {
'jid': Strophe.getBareJidFromJid(jid) || _.get(occupant, 'attributes.jid'),
'resource': Strophe.getResourceFromJid(jid) || _.get(occupant, 'attributes.resource')
});
......@@ -1224,10 +1224,10 @@ converse.plugins.add('converse-muc', {
},
initialize (attributes) {
this.set(_.extend({
'id': _converse.connection.getUniqueId(),
}, attributes));
this.set(Object.assign(
{'id': _converse.connection.getUniqueId()},
attributes)
);
this.on('change:image_hash', this.onAvatarChanged, this);
},
......@@ -1501,7 +1501,7 @@ converse.plugins.add('converse-muc', {
/************************ BEGIN API ************************/
// We extend the default converse.js API to add methods specific to MUC groupchats.
_.extend(_converse.api, {
Object.assign(_converse.api, {
/**
* The "rooms" namespace groups methods relevant to chatrooms
* (aka groupchats).
......
......@@ -26,7 +26,7 @@ converse.plugins.add('converse-pubsub', {
/************************ BEGIN API ************************/
// We extend the default converse.js API to add methods specific to MUC groupchats.
_.extend(_converse.api, {
Object.assign(_converse.api, {
/**
* The "pubsub" namespace groups methods relevant to PubSub
*
......
......@@ -968,7 +968,7 @@ converse.plugins.add('converse-roster', {
/************************ API ************************/
// API methods only available to plugins
_.extend(_converse.api, {
Object.assign(_converse.api, {
/**
* @namespace _converse.api.contacts
* @memberOf _converse.api
......
......@@ -118,7 +118,7 @@ converse.plugins.add('converse-vcard', {
return onVCardData(jid, iq);
}
/* Event handlers */
/************************ BEGIN Event Handlers ************************/
_converse.initVCardCollection = function () {
_converse.vcards = new _converse.VCards();
const id = `${_converse.bare_jid}-converse.vcards`;
......@@ -139,7 +139,8 @@ converse.plugins.add('converse-vcard', {
_converse.api.disco.own.features.add(Strophe.NS.VCARD);
});
_.extend(_converse.api, {
/************************ BEGIN API ************************/
Object.assign(_converse.api, {
/**
* The XEP-0054 VCard API
*
......
......@@ -30205,7 +30205,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
//# sourceMappingURL=pluggable.js.map
/***/ }),
/***/ "./node_modules/process/browser.js":
......@@ -40994,7 +40993,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
'type': 'error'
});
} else {
const message = this.messages.create(_.extend(this.getOutgoingMessageAttributes(), {
const message = this.messages.create(Object.assign(this.getOutgoingMessageAttributes(), {
'file': true,
'progress': 0,
'slot_request_url': slot_request_url
......@@ -41092,7 +41091,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
text = this.getMessageBody(stanza) || undefined,
chat_state = stanza.getElementsByTagName(_converse.COMPOSING).length && _converse.COMPOSING || stanza.getElementsByTagName(_converse.PAUSED).length && _converse.PAUSED || stanza.getElementsByTagName(_converse.INACTIVE).length && _converse.INACTIVE || stanza.getElementsByTagName(_converse.ACTIVE).length && _converse.ACTIVE || stanza.getElementsByTagName(_converse.GONE).length && _converse.GONE;
const attrs = _.extend({
const attrs = Object.assign({
'chat_state': chat_state,
'is_archived': this.isArchived(original_stanza),
'is_delayed': !_.isNil(delay),
......@@ -41413,11 +41412,10 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
let chatbox = this.get(Strophe.getBareJidFromJid(jid));
if (!chatbox && create) {
_.extend(attrs, {
Object.assign(attrs, {
'jid': jid,
'id': jid
});
chatbox = this.create(attrs, {
'error'(model, response) {
_converse.log(response.responseText);
......@@ -41491,7 +41489,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
/************************ BEGIN API ************************/
_.extend(_converse.api, {
Object.assign(_converse.api, {
/**
* The "chats" namespace (used for one-on-one chats)
*
......@@ -41636,7 +41634,6 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
}
});
/************************ END API ************************/
}
});
......@@ -41746,9 +41743,7 @@ const _converse = {
'promises': {}
};
_converse.VERSION_NAME = "v4.2.0";
_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.extend(_converse, Backbone.Events); // Make converse pluggable
Object.assign(_converse, Backbone.Events); // Make converse pluggable
pluggable_js_dist_pluggable__WEBPACK_IMPORTED_MODULE_8___default.a.enable(_converse, '_converse', 'pluggable'); // Core plugins are whitelisted automatically
// These are just the @converse/headless plugins, for the full converse,
......@@ -44168,7 +44163,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-dis
return true;
}
_.extend(_converse.api, {
Object.assign(_converse.api, {
/**
* The XEP-0030 service discovery API
*
......@@ -44679,8 +44674,7 @@ function queryForArchivedMessages(_converse, options, callback, errback) {
rsm = new Strophe.RSM({
xml: set
});
_.extend(rsm, _.pick(options, _.concat(MAM_ATTRIBUTES, ['max'])));
Object.assign(rsm, _.pick(options, _.concat(MAM_ATTRIBUTES, ['max'])));
}
callback(messages, rsm);
......@@ -44739,7 +44733,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-mam
const attrs = this.__super__.getUpdatedMessageAttributes.apply(this, arguments);
if (message && !message.get('is_archived')) {
return _.extend(attrs, {
return Object.assign(attrs, {
'is_archived': this.isArchived(stanza)
}, this.getStanzaIDs(stanza));
}
......@@ -44837,7 +44831,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-mam
/************************ BEGIN API ************************/
_.extend(_converse.api, {
Object.assign(_converse.api, {
/**
* The [XEP-0313](https://xmpp.org/extensions/xep-0313.html) Message Archive Management API
*
......@@ -45017,7 +45011,6 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-mam
}
});
/************************ END API ************************/
}
});
......@@ -45681,11 +45674,9 @@ _converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins.add('converse-muc
}), 'attributes.value')
});
const features = await _converse.api.disco.getFeatures(this.get('jid'));
const attrs = _.extend(_.zipObject(_converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].ROOM_FEATURES, _.map(_converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].ROOM_FEATURES, _.stubFalse)), {
const attrs = Object.assign(_.zipObject(_converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].ROOM_FEATURES, _.map(_converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].ROOM_FEATURES, _.stubFalse)), {
'fetched': moment().format()
});
features.each(feature => {
const fieldname = feature.get('var');
......@@ -46095,8 +46086,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins.add('converse-muc
}
const jid = data.jid || '';
const attributes = _.extend(data, {
const attributes = Object.assign(data, {
'jid': Strophe.getBareJidFromJid(jid) || _.get(occupant, 'attributes.jid'),
'resource': Strophe.getResourceFromJid(jid) || _.get(occupant, 'attributes.resource')
});
......@@ -46438,7 +46428,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins.add('converse-muc
},
initialize(attributes) {
this.set(_.extend({
this.set(Object.assign({
'id': _converse.connection.getUniqueId()
}, attributes));
this.on('change:image_hash', this.onAvatarChanged, this);
......@@ -46743,7 +46733,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins.add('converse-muc
// We extend the default converse.js API to add methods specific to MUC groupchats.
_.extend(_converse.api, {
Object.assign(_converse.api, {
/**
* The "rooms" namespace groups methods relevant to chatrooms
* (aka groupchats).
......@@ -46924,7 +46914,6 @@ _converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins.add('converse-muc
}
});
/************************ END API ************************/
}
});
......@@ -47104,7 +47093,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_1__["default"].plugins.add('converse-pub
/************************ BEGIN API ************************/
// We extend the default converse.js API to add methods specific to MUC groupchats.
_.extend(_converse.api, {
Object.assign(_converse.api, {
/**
* The "pubsub" namespace groups methods relevant to PubSub
*
......@@ -47179,7 +47168,6 @@ _converse_core__WEBPACK_IMPORTED_MODULE_1__["default"].plugins.add('converse-pub
}
});
/************************ END API ************************/
}
});
......@@ -48293,7 +48281,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
// API methods only available to plugins
_.extend(_converse.api, {
Object.assign(_converse.api, {
/**
* @namespace _converse.api.contacts
* @memberOf _converse.api
......@@ -48521,7 +48509,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-vca
return onVCardData(jid, iq);
}
/* Event handlers */
/************************ BEGIN Event Handlers ************************/
_converse.initVCardCollection = function () {
......@@ -48549,8 +48537,10 @@ _converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins.add('converse-vca
_converse.api.listen.on('addClientFeatures', () => {
_converse.api.disco.own.features.add(Strophe.NS.VCARD);
});
/************************ BEGIN API ************************/
_.extend(_converse.api, {
Object.assign(_converse.api, {
/**
* The XEP-0054 VCard API
*
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