Commit e20b6548 authored by JC Brand's avatar JC Brand

Stop using `_.isUndefined`

parent caad85f4
...@@ -161,7 +161,7 @@ ...@@ -161,7 +161,7 @@
'name': 'The Lounge', 'name': 'The Lounge',
'nick': ' Othello' 'nick': ' Othello'
}); });
expect(_.isUndefined(_converse.chatboxviews.get(jid))).toBeTruthy(); expect(_converse.chatboxviews.get(jid) === undefined).toBeTruthy();
jid = 'theplay@conference.shakespeare.lit'; jid = 'theplay@conference.shakespeare.lit';
_converse.bookmarks.create({ _converse.bookmarks.create({
...@@ -170,7 +170,7 @@ ...@@ -170,7 +170,7 @@
'name': 'The Play', 'name': 'The Play',
'nick': ' Othello' 'nick': ' Othello'
}); });
expect(_.isUndefined(_converse.chatboxviews.get(jid))).toBeFalsy(); expect(_converse.chatboxviews.get(jid) === undefined).toBeFalsy();
// Check that we don't auto-join if muc_respect_autojoin is false // Check that we don't auto-join if muc_respect_autojoin is false
_converse.muc_respect_autojoin = false; _converse.muc_respect_autojoin = false;
...@@ -181,7 +181,7 @@ ...@@ -181,7 +181,7 @@
'name': 'Balcony', 'name': 'Balcony',
'nick': ' Othello' 'nick': ' Othello'
}); });
expect(_.isUndefined(_converse.chatboxviews.get(jid))).toBe(true); expect(_converse.chatboxviews.get(jid) === undefined).toBe(true);
done(); done();
})); }));
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
expect(_.includes(list.classList, 'hidden')).toBeTruthy(); expect(_.includes(list.classList, 'hidden')).toBeTruthy();
await test_utils.openChatRoom(_converse, 'room', 'conference.shakespeare.lit', 'JC'); await test_utils.openChatRoom(_converse, 'room', 'conference.shakespeare.lit', 'JC');
expect(_.isUndefined(_converse.rooms_list_view)).toBeFalsy(); expect(_converse.rooms_list_view === undefined).toBeFalsy();
const lview = _converse.rooms_list_view const lview = _converse.rooms_list_view
await u.waitUntil(() => lview.el.querySelectorAll(".open-room").length); await u.waitUntil(() => lview.el.querySelectorAll(".open-room").length);
...@@ -288,7 +288,7 @@ ...@@ -288,7 +288,7 @@
test_utils.openControlBox(); test_utils.openControlBox();
const room_jid = 'kitchen@conference.shakespeare.lit'; const room_jid = 'kitchen@conference.shakespeare.lit';
await u.waitUntil(() => !_.isUndefined(_converse.rooms_list_view), 500); await u.waitUntil(() => _converse.rooms_list_view !== undefined, 500);
await test_utils.openAndEnterChatRoom(_converse, 'kitchen@conference.shakespeare.lit', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'kitchen@conference.shakespeare.lit', 'romeo');
const view = _converse.chatboxviews.get(room_jid); const view = _converse.chatboxviews.get(room_jid);
view.model.set({'minimized': true}); view.model.set({'minimized': true});
......
...@@ -129,7 +129,7 @@ converse.plugins.add('converse-bookmark-views', { ...@@ -129,7 +129,7 @@ converse.plugins.add('converse-bookmark-views', {
setBookmarkState () { setBookmarkState () {
/* Set whether the groupchat is bookmarked or not. /* Set whether the groupchat is bookmarked or not.
*/ */
if (!_.isUndefined(_converse.bookmarks)) { if (_converse.bookmarks !== undefined) {
const models = _converse.bookmarks.where({'jid': this.model.get('jid')}); const models = _converse.bookmarks.where({'jid': this.model.get('jid')});
if (!models.length) { if (!models.length) {
this.model.save('bookmarked', false); this.model.save('bookmarked', false);
...@@ -278,7 +278,7 @@ converse.plugins.add('converse-bookmark-views', { ...@@ -278,7 +278,7 @@ converse.plugins.add('converse-bookmark-views', {
insertIntoControlBox () { insertIntoControlBox () {
const controlboxview = _converse.chatboxviews.get('controlbox'); const controlboxview = _converse.chatboxviews.get('controlbox');
if (!_.isUndefined(controlboxview) && !u.rootContains(_converse.root, this.el)) { if (controlboxview !== undefined && !u.rootContains(_converse.root, this.el)) {
const el = controlboxview.el.querySelector('.bookmarks-list'); const el = controlboxview.el.querySelector('.bookmarks-list');
if (!_.isNull(el)) { if (!_.isNull(el)) {
el.parentNode.replaceChild(this.el, el); el.parentNode.replaceChild(this.el, el);
......
...@@ -251,13 +251,13 @@ converse.plugins.add('converse-chatview', { ...@@ -251,13 +251,13 @@ converse.plugins.add('converse-chatview', {
'_converse': _converse, '_converse': _converse,
'allow_contact_removal': _converse.allow_contact_removal, 'allow_contact_removal': _converse.allow_contact_removal,
'display_name': this.model.getDisplayName(), 'display_name': this.model.getDisplayName(),
'is_roster_contact': !_.isUndefined(this.model.contact), 'is_roster_contact': this.model.contact !== undefined,
'utils': u 'utils': u
})); }));
}, },
registerContactEventHandlers () { registerContactEventHandlers () {
if (!_.isUndefined(this.model.contact)) { if (this.model.contact !== undefined) {
this.model.contact.on('change', this.render, this); this.model.contact.on('change', this.render, this);
this.model.contact.vcard.on('change', this.render, this); this.model.contact.vcard.on('change', this.render, this);
this.model.contact.on('destroy', () => { this.model.contact.on('destroy', () => {
...@@ -447,7 +447,7 @@ converse.plugins.add('converse-chatview', { ...@@ -447,7 +447,7 @@ converse.plugins.add('converse-chatview', {
showUserDetailsModal (ev) { showUserDetailsModal (ev) {
ev.preventDefault(); ev.preventDefault();
if (_.isUndefined(this.user_details_modal)) { if (this.user_details_modal === undefined) {
this.user_details_modal = new _converse.UserDetailsModal({model: this.model}); this.user_details_modal = new _converse.UserDetailsModal({model: this.model});
} }
this.user_details_modal.show(ev); this.user_details_modal.show(ev);
...@@ -518,7 +518,7 @@ converse.plugins.add('converse-chatview', { ...@@ -518,7 +518,7 @@ converse.plugins.add('converse-chatview', {
this.heading.render(); this.heading.render();
this.heading.chatview = this; this.heading.chatview = this;
if (!_.isUndefined(this.model.contact)) { if (this.model.contact !== undefined) {
this.model.contact.on('destroy', this.heading.render, this); this.model.contact.on('destroy', this.heading.render, this);
} }
const flyout = this.el.querySelector('.flyout'); const flyout = this.el.querySelector('.flyout');
...@@ -1140,7 +1140,7 @@ converse.plugins.add('converse-chatview', { ...@@ -1140,7 +1140,7 @@ converse.plugins.add('converse-chatview', {
}, },
createEmojiPicker () { createEmojiPicker () {
if (_.isUndefined(_converse.emojipicker)) { if (_converse.emojipicker === undefined) {
const storage = _converse.config.get('storage'), const storage = _converse.config.get('storage'),
id = `converse.emoji-${_converse.bare_jid}`; id = `converse.emoji-${_converse.bare_jid}`;
_converse.emojipicker = new _converse.EmojiPicker({'id': id}); _converse.emojipicker = new _converse.EmojiPicker({'id': id});
...@@ -1160,7 +1160,7 @@ converse.plugins.add('converse-chatview', { ...@@ -1160,7 +1160,7 @@ converse.plugins.add('converse-chatview', {
}, },
toggleEmojiMenu (ev) { toggleEmojiMenu (ev) {
if (_.isUndefined(this.emoji_dropdown)) { if (this.emoji_dropdown === undefined) {
ev.stopPropagation(); ev.stopPropagation();
this.createEmojiPicker(); this.createEmojiPicker();
this.insertEmojiPicker(); this.insertEmojiPicker();
...@@ -1383,7 +1383,7 @@ converse.plugins.add('converse-chatview', { ...@@ -1383,7 +1383,7 @@ converse.plugins.add('converse-chatview', {
_scrollDown () { _scrollDown () {
/* Inner method that gets debounced */ /* Inner method that gets debounced */
if (_.isUndefined(this.content)) { if (this.content === undefined) {
return; return;
} }
if (u.isVisible(this.content) && !this.model.get('scrolled')) { if (u.isVisible(this.content) && !this.model.get('scrolled')) {
...@@ -1461,7 +1461,7 @@ converse.plugins.add('converse-chatview', { ...@@ -1461,7 +1461,7 @@ converse.plugins.add('converse-chatview', {
* _converse.api.chatviews.get(['buddy1@example.com', 'buddy2@example.com']) * _converse.api.chatviews.get(['buddy1@example.com', 'buddy2@example.com'])
*/ */
'get' (jids) { 'get' (jids) {
if (_.isUndefined(jids)) { if (jids === undefined) {
_converse.log( _converse.log(
"chatviews.get: You need to provide at least one JID", "chatviews.get: You need to provide at least one JID",
Strophe.LogLevel.ERROR Strophe.LogLevel.ERROR
......
...@@ -186,7 +186,7 @@ converse.plugins.add('converse-controlbox', { ...@@ -186,7 +186,7 @@ converse.plugins.add('converse-controlbox', {
}, },
initialize () { initialize () {
if (_.isUndefined(_converse.controlboxtoggle)) { if (_converse.controlboxtoggle === undefined) {
_converse.controlboxtoggle = new _converse.ControlBoxToggle(); _converse.controlboxtoggle = new _converse.ControlBoxToggle();
} }
_converse.controlboxtoggle.el.insertAdjacentElement('afterend', this.el); _converse.controlboxtoggle.el.insertAdjacentElement('afterend', this.el);
...@@ -214,7 +214,7 @@ converse.plugins.add('converse-controlbox', { ...@@ -214,7 +214,7 @@ converse.plugins.add('converse-controlbox', {
render () { render () {
if (this.model.get('connected')) { if (this.model.get('connected')) {
if (_.isUndefined(this.model.get('closed'))) { if (this.model.get('closed') === undefined) {
this.model.set('closed', !_converse.show_controlbox_by_default); this.model.set('closed', !_converse.show_controlbox_by_default);
} }
} }
......
...@@ -153,7 +153,7 @@ converse.plugins.add('converse-dragresize', { ...@@ -153,7 +153,7 @@ converse.plugins.add('converse-dragresize', {
const flyout = this.el.querySelector('.box-flyout'); const flyout = this.el.querySelector('.box-flyout');
const style = window.getComputedStyle(flyout); const style = window.getComputedStyle(flyout);
if (_.isUndefined(this.model.get('height'))) { if (this.model.get('height') === undefined) {
const height = parseInt(style.height.replace(/px$/, ''), 10); const height = parseInt(style.height.replace(/px$/, ''), 10);
const width = parseInt(style.width.replace(/px$/, ''), 10); const width = parseInt(style.width.replace(/px$/, ''), 10);
this.model.set('height', height); this.model.set('height', height);
...@@ -313,9 +313,9 @@ converse.plugins.add('converse-dragresize', { ...@@ -313,9 +313,9 @@ converse.plugins.add('converse-dragresize', {
* default_value. If value is close enough to * default_value. If value is close enough to
* default_value, then default_value is returned instead. * default_value, then default_value is returned instead.
*/ */
if (_.isUndefined(value)) { if (value === undefined) {
return undefined; return undefined;
} else if (_.isUndefined(default_value)) { } else if (default_value === undefined) {
return value; return value;
} }
const resistance = 10; const resistance = 10;
......
...@@ -308,7 +308,7 @@ converse.plugins.add('converse-message-view', { ...@@ -308,7 +308,7 @@ converse.plugins.add('converse-message-view', {
showMessageVersionsModal (ev) { showMessageVersionsModal (ev) {
ev.preventDefault(); ev.preventDefault();
if (_.isUndefined(this.model.message_versions_modal)) { if (this.model.message_versions_modal === undefined) {
this.model.message_versions_modal = new _converse.MessageVersionsModal({'model': this.model}); this.model.message_versions_modal = new _converse.MessageVersionsModal({'model': this.model});
} }
this.model.message_versions_modal.show(ev); this.model.message_versions_modal.show(ev);
......
...@@ -91,7 +91,7 @@ converse.plugins.add('converse-modal', { ...@@ -91,7 +91,7 @@ converse.plugins.add('converse-modal', {
type = 'alert-warning'; type = 'alert-warning';
} }
if (_.isUndefined(alert)) { if (alert === undefined) {
const model = new Backbone.Model({ const model = new Backbone.Model({
'title': title, 'title': title,
'messages': messages, 'messages': messages,
......
...@@ -596,7 +596,7 @@ converse.plugins.add('converse-muc-views', { ...@@ -596,7 +596,7 @@ converse.plugins.add('converse-muc-views', {
showRoomDetailsModal (ev) { showRoomDetailsModal (ev) {
ev.preventDefault(); ev.preventDefault();
if (_.isUndefined(this.model.room_details_modal)) { if (this.model.room_details_modal === undefined) {
this.model.room_details_modal = new _converse.RoomDetailsModal({'model': this.model}); this.model.room_details_modal = new _converse.RoomDetailsModal({'model': this.model});
} }
this.model.room_details_modal.show(ev); this.model.room_details_modal.show(ev);
...@@ -1528,14 +1528,14 @@ converse.plugins.add('converse-muc-views', { ...@@ -1528,14 +1528,14 @@ converse.plugins.add('converse-muc-views', {
}, },
showAddRoomModal (ev) { showAddRoomModal (ev) {
if (_.isUndefined(this.add_room_modal)) { if (this.add_room_modal === undefined) {
this.add_room_modal = new _converse.AddChatRoomModal({'model': this.model}); this.add_room_modal = new _converse.AddChatRoomModal({'model': this.model});
} }
this.add_room_modal.show(ev); this.add_room_modal.show(ev);
}, },
showListRoomsModal(ev) { showListRoomsModal(ev) {
if (_.isUndefined(this.list_rooms_modal)) { if (this.list_rooms_modal === undefined) {
this.list_rooms_modal = new _converse.ListChatRoomsModal({'model': this.model}); this.list_rooms_modal = new _converse.ListChatRoomsModal({'model': this.model});
} }
this.list_rooms_modal.show(ev); this.list_rooms_modal.show(ev);
...@@ -1896,7 +1896,7 @@ converse.plugins.add('converse-muc-views', { ...@@ -1896,7 +1896,7 @@ converse.plugins.add('converse-muc-views', {
function fetchAndSetMUCDomain (controlboxview) { function fetchAndSetMUCDomain (controlboxview) {
if (controlboxview.model.get('connected')) { if (controlboxview.model.get('connected')) {
if (!controlboxview.roomspanel.model.get('muc_domain')) { if (!controlboxview.roomspanel.model.get('muc_domain')) {
if (_.isUndefined(_converse.muc_domain)) { if (_converse.muc_domain === undefined) {
setMUCDomainFromDisco(controlboxview); setMUCDomainFromDisco(controlboxview);
} else { } else {
setMUCDomain(_converse.muc_domain, controlboxview); setMUCDomain(_converse.muc_domain, controlboxview);
...@@ -2001,7 +2001,7 @@ converse.plugins.add('converse-muc-views', { ...@@ -2001,7 +2001,7 @@ converse.plugins.add('converse-muc-views', {
*/ */
'close' (jids) { 'close' (jids) {
let views; let views;
if (_.isUndefined(jids)) { if (jids === undefined) {
views = _converse.chatboxviews; views = _converse.chatboxviews;
} else if (_.isString(jids)) { } else if (_.isString(jids)) {
views = [_converse.chatboxviews.get(jids)].filter(v => v); views = [_converse.chatboxviews.get(jids)].filter(v => v);
......
...@@ -111,7 +111,7 @@ converse.plugins.add('converse-notification', { ...@@ -111,7 +111,7 @@ converse.plugins.add('converse-notification', {
// XXX Eventually this can be refactored to use Notification's sound // XXX Eventually this can be refactored to use Notification's sound
// feature, but no browser currently supports it. // feature, but no browser currently supports it.
// https://developer.mozilla.org/en-US/docs/Web/API/notification/sound // https://developer.mozilla.org/en-US/docs/Web/API/notification/sound
if (_converse.play_sounds && !_.isUndefined(window.Audio)) { if (_converse.play_sounds && window.Audio !== undefined) {
const audioOgg = new Audio(_converse.sounds_path+"msg_received.ogg"); const audioOgg = new Audio(_converse.sounds_path+"msg_received.ogg");
const canPlayOgg = audioOgg.canPlayType('audio/ogg'); const canPlayOgg = audioOgg.canPlayType('audio/ogg');
if (canPlayOgg === 'probably') { if (canPlayOgg === 'probably') {
...@@ -157,14 +157,14 @@ converse.plugins.add('converse-notification', { ...@@ -157,14 +157,14 @@ converse.plugins.add('converse-notification', {
} else if (message.getAttribute('type') === 'groupchat') { } else if (message.getAttribute('type') === 'groupchat') {
title = __("%1$s says", Strophe.getResourceFromJid(full_from_jid)); title = __("%1$s says", Strophe.getResourceFromJid(full_from_jid));
} else { } else {
if (_.isUndefined(_converse.roster)) { if (_converse.roster === undefined) {
_converse.log( _converse.log(
"Could not send notification, because roster is undefined", "Could not send notification, because roster is undefined",
Strophe.LogLevel.ERROR); Strophe.LogLevel.ERROR);
return; return;
} }
roster_item = _converse.roster.get(from_jid); roster_item = _converse.roster.get(from_jid);
if (!_.isUndefined(roster_item)) { if (roster_item !== undefined) {
title = __("%1$s says", roster_item.getDisplayName()); title = __("%1$s says", roster_item.getDisplayName());
} else { } else {
if (_converse.allow_non_roster_messaging) { if (_converse.allow_non_roster_messaging) {
......
...@@ -42,7 +42,7 @@ converse.plugins.add("converse-oauth", { ...@@ -42,7 +42,7 @@ converse.plugins.add("converse-oauth", {
insertOAuthProviders () { insertOAuthProviders () {
const { _converse } = this.__super__; const { _converse } = this.__super__;
if (_.isUndefined(this.oauth_providers_view)) { if (this.oauth_providers_view === undefined) {
this.oauth_providers_view = this.oauth_providers_view =
new _converse.OAuthProvidersView({'model': _converse.oauth_providers}); new _converse.OAuthProvidersView({'model': _converse.oauth_providers});
......
...@@ -902,7 +902,7 @@ converse.plugins.add('converse-omemo', { ...@@ -902,7 +902,7 @@ converse.plugins.add('converse-omemo', {
}, },
fetchSession () { fetchSession () {
if (_.isUndefined(this._setup_promise)) { if (this._setup_promise === undefined) {
this._setup_promise = new Promise((resolve, reject) => { this._setup_promise = new Promise((resolve, reject) => {
this.fetch({ this.fetch({
'success': () => { 'success': () => {
...@@ -1012,7 +1012,7 @@ converse.plugins.add('converse-omemo', { ...@@ -1012,7 +1012,7 @@ converse.plugins.add('converse-omemo', {
}, },
fetchDevices () { fetchDevices () {
if (_.isUndefined(this._devices_promise)) { if (this._devices_promise === undefined) {
this._devices_promise = new Promise(resolve => { this._devices_promise = new Promise(resolve => {
this.devices.fetch({ this.devices.fetch({
'success': _.flow(c => this.onDevicesFound(c), resolve), 'success': _.flow(c => this.onDevicesFound(c), resolve),
...@@ -1172,7 +1172,7 @@ converse.plugins.add('converse-omemo', { ...@@ -1172,7 +1172,7 @@ converse.plugins.add('converse-omemo', {
} }
function restoreOMEMOSession () { function restoreOMEMOSession () {
if (_.isUndefined(_converse.omemo_store)) { if (_converse.omemo_store === undefined) {
const storage = _converse.config.get('storage'), const storage = _converse.config.get('storage'),
id = `converse.omemosession-${_converse.bare_jid}`; id = `converse.omemosession-${_converse.bare_jid}`;
_converse.omemo_store = new _converse.OMEMOStore({'id': id}); _converse.omemo_store = new _converse.OMEMOStore({'id': id});
......
...@@ -262,21 +262,21 @@ converse.plugins.add('converse-profile', { ...@@ -262,21 +262,21 @@ converse.plugins.add('converse-profile', {
}, },
showProfileModal (ev) { showProfileModal (ev) {
if (_.isUndefined(this.profile_modal)) { if (this.profile_modal === undefined) {
this.profile_modal = new _converse.ProfileModal({model: this.model}); this.profile_modal = new _converse.ProfileModal({model: this.model});
} }
this.profile_modal.show(ev); this.profile_modal.show(ev);
}, },
showStatusChangeModal (ev) { showStatusChangeModal (ev) {
if (_.isUndefined(this.status_modal)) { if (this.status_modal === undefined) {
this.status_modal = new _converse.ChatStatusModal({model: this.model}); this.status_modal = new _converse.ChatStatusModal({model: this.model});
} }
this.status_modal.show(ev); this.status_modal.show(ev);
}, },
showClientInfoModal(ev) { showClientInfoModal(ev) {
if (_.isUndefined(this.client_info_modal)) { if (this.client_info_modal === undefined) {
this.client_info_modal = new _converse.ClientInfoModal({model: this.model}); this.client_info_modal = new _converse.ClientInfoModal({model: this.model});
} }
this.client_info_modal.show(ev); this.client_info_modal.show(ev);
......
...@@ -90,7 +90,7 @@ converse.plugins.add('converse-register', { ...@@ -90,7 +90,7 @@ converse.plugins.add('converse-register', {
Object.assign(_converse.LoginPanel.prototype, { Object.assign(_converse.LoginPanel.prototype, {
insertRegisterLink () { insertRegisterLink () {
if (_.isUndefined(this.registerlinkview)) { if (this.registerlinkview === undefined) {
this.registerlinkview = new _converse.RegisterLinkView({'model': this.model}); this.registerlinkview = new _converse.RegisterLinkView({'model': this.model});
this.registerlinkview.render(); this.registerlinkview.render();
const buttons = this.el.querySelector('.buttons'); const buttons = this.el.querySelector('.buttons');
......
...@@ -135,7 +135,7 @@ converse.plugins.add('converse-roomslist', { ...@@ -135,7 +135,7 @@ converse.plugins.add('converse-roomslist', {
showRoomDetailsModal (ev) { showRoomDetailsModal (ev) {
const room = _converse.chatboxes.get(this.model.get('jid')); const room = _converse.chatboxes.get(this.model.get('jid'));
ev.preventDefault(); ev.preventDefault();
if (_.isUndefined(room.room_details_modal)) { if (room.room_details_modal === undefined) {
room.room_details_modal = new _converse.RoomDetailsModal({'model': room}); room.room_details_modal = new _converse.RoomDetailsModal({'model': room});
} }
room.room_details_modal.show(ev); room.room_details_modal.show(ev);
...@@ -199,7 +199,7 @@ converse.plugins.add('converse-roomslist', { ...@@ -199,7 +199,7 @@ converse.plugins.add('converse-roomslist', {
insertIntoControlBox () { insertIntoControlBox () {
const controlboxview = _converse.chatboxviews.get('controlbox'); const controlboxview = _converse.chatboxviews.get('controlbox');
if (!_.isUndefined(controlboxview) && !u.rootContains(_converse.root, this.el)) { if (controlboxview !== undefined && !u.rootContains(_converse.root, this.el)) {
const el = controlboxview.el.querySelector('.open-rooms-list'); const el = controlboxview.el.querySelector('.open-rooms-list');
if (!_.isNull(el)) { if (!_.isNull(el)) {
el.parentNode.replaceChild(this.el, el); el.parentNode.replaceChild(this.el, el);
......
...@@ -784,7 +784,7 @@ converse.plugins.add('converse-rosterview', { ...@@ -784,7 +784,7 @@ converse.plugins.add('converse-rosterview', {
}, },
showAddContactModal (ev) { showAddContactModal (ev) {
if (_.isUndefined(this.add_contact_modal)) { if (this.add_contact_modal === undefined) {
this.add_contact_modal = new _converse.AddContactModal({'model': new Backbone.Model()}); this.add_contact_modal = new _converse.AddContactModal({'model': new Backbone.Model()});
} }
this.add_contact_modal.show(ev); this.add_contact_modal.show(ev);
...@@ -944,7 +944,7 @@ converse.plugins.add('converse-rosterview', { ...@@ -944,7 +944,7 @@ converse.plugins.add('converse-rosterview', {
_converse.api.listen.on('chatBoxesInitialized', () => { _converse.api.listen.on('chatBoxesInitialized', () => {
function highlightRosterItem (chatbox) { function highlightRosterItem (chatbox) {
const contact = _converse.roster.findWhere({'jid': chatbox.get('jid')}); const contact = _converse.roster.findWhere({'jid': chatbox.get('jid')});
if (!_.isUndefined(contact)) { if (contact !== undefined) {
contact.trigger('highlight'); contact.trigger('highlight');
} }
} }
......
...@@ -192,14 +192,14 @@ converse.plugins.add('converse-bookmarks', { ...@@ -192,14 +192,14 @@ converse.plugins.add('converse-bookmarks', {
markRoomAsBookmarked (bookmark) { markRoomAsBookmarked (bookmark) {
const groupchat = _converse.chatboxes.get(bookmark.get('jid')); const groupchat = _converse.chatboxes.get(bookmark.get('jid'));
if (!_.isUndefined(groupchat)) { if (groupchat !== undefined) {
groupchat.save('bookmarked', true); groupchat.save('bookmarked', true);
} }
}, },
markRoomAsUnbookmarked (bookmark) { markRoomAsUnbookmarked (bookmark) {
const groupchat = _converse.chatboxes.get(bookmark.get('jid')); const groupchat = _converse.chatboxes.get(bookmark.get('jid'));
if (!_.isUndefined(groupchat)) { if (groupchat !== undefined) {
groupchat.save('bookmarked', false); groupchat.save('bookmarked', false);
} }
}, },
...@@ -222,7 +222,7 @@ converse.plugins.add('converse-bookmarks', { ...@@ -222,7 +222,7 @@ converse.plugins.add('converse-bookmarks', {
onBookmarksReceived (deferred, iq) { onBookmarksReceived (deferred, iq) {
this.createBookmarksFromStanza(iq); this.createBookmarksFromStanza(iq);
if (!_.isUndefined(deferred)) { if (deferred !== undefined) {
return deferred.resolve(); return deferred.resolve();
} }
}, },
...@@ -276,7 +276,7 @@ converse.plugins.add('converse-bookmarks', { ...@@ -276,7 +276,7 @@ converse.plugins.add('converse-bookmarks', {
} }
_converse.api.listen.on('clearSession', () => { _converse.api.listen.on('clearSession', () => {
if (!_.isUndefined(_converse.bookmarks)) { if (_converse.bookmarks !== undefined) {
_converse.bookmarks.reset(); _converse.bookmarks.reset();
_converse.bookmarks.browserStorage._clear(); _converse.bookmarks.browserStorage._clear();
window.sessionStorage.removeItem(_converse.bookmarks.fetched_flag); window.sessionStorage.removeItem(_converse.bookmarks.fetched_flag);
......
...@@ -415,7 +415,7 @@ converse.plugins.add('converse-chatboxes', { ...@@ -415,7 +415,7 @@ converse.plugins.add('converse-chatboxes', {
* @param { string } state - The chat state (consts ACTIVE, COMPOSING, PAUSED, INACTIVE, GONE) * @param { string } state - The chat state (consts ACTIVE, COMPOSING, PAUSED, INACTIVE, GONE)
*/ */
setChatState (state, options) { setChatState (state, options) {
if (!_.isUndefined(this.chat_state_timeout)) { if (this.chat_state_timeout !== undefined) {
window.clearTimeout(this.chat_state_timeout); window.clearTimeout(this.chat_state_timeout);
delete this.chat_state_timeout; delete this.chat_state_timeout;
} }
...@@ -611,7 +611,7 @@ converse.plugins.add('converse-chatboxes', { ...@@ -611,7 +611,7 @@ converse.plugins.add('converse-chatboxes', {
}, },
handleReceipt (stanza, from_jid, is_carbon, is_me, is_mam) { handleReceipt (stanza, from_jid, is_carbon, is_me, is_mam) {
const requests_receipt = !_.isUndefined(sizzle(`request[xmlns="${Strophe.NS.RECEIPTS}"]`, stanza).pop()); const requests_receipt = sizzle(`request[xmlns="${Strophe.NS.RECEIPTS}"]`, stanza).pop() !== undefined;
if (requests_receipt && !is_carbon && !is_me) { if (requests_receipt && !is_carbon && !is_me) {
this.sendReceiptStanza(from_jid, stanza.getAttribute('id')); this.sendReceiptStanza(from_jid, stanza.getAttribute('id'));
} }
...@@ -1112,7 +1112,7 @@ converse.plugins.add('converse-chatboxes', { ...@@ -1112,7 +1112,7 @@ converse.plugins.add('converse-chatboxes', {
} }
const contact_jid = is_me ? Strophe.getBareJidFromJid(to_jid) : from_bare_jid; const contact_jid = is_me ? Strophe.getBareJidFromJid(to_jid) : from_bare_jid;
const contact = await _converse.api.contacts.get(contact_jid); const contact = await _converse.api.contacts.get(contact_jid);
const is_roster_contact = !_.isUndefined(contact); const is_roster_contact = contact !== undefined;
if (!is_me && !is_roster_contact && !_converse.allow_non_roster_messaging) { if (!is_me && !is_roster_contact && !_converse.allow_non_roster_messaging) {
return; return;
} }
...@@ -1365,7 +1365,7 @@ converse.plugins.add('converse-chatboxes', { ...@@ -1365,7 +1365,7 @@ converse.plugins.add('converse-chatboxes', {
* *
*/ */
get (jids) { get (jids) {
if (_.isUndefined(jids)) { if (jids === undefined) {
const result = []; const result = [];
_converse.chatboxes.each(function (chatbox) { _converse.chatboxes.each(function (chatbox) {
// FIXME: Leaky abstraction from MUC. We need to add a // FIXME: Leaky abstraction from MUC. We need to add a
......
...@@ -291,7 +291,7 @@ Strophe.error = function (msg) { _converse.log(msg, Strophe.LogLevel.ERROR); }; ...@@ -291,7 +291,7 @@ Strophe.error = function (msg) { _converse.log(msg, Strophe.LogLevel.ERROR); };
* @param { String } str - The string to translate * @param { String } str - The string to translate
*/ */
_converse.__ = function (str) { _converse.__ = function (str) {
if (_.isUndefined(i18n)) { if (i18n === undefined) {
return str; return str;
} }
return i18n.translate.apply(i18n, arguments); return i18n.translate.apply(i18n, arguments);
...@@ -505,7 +505,7 @@ const debouncedReconnect = _.debounce(reconnect, 2000); ...@@ -505,7 +505,7 @@ const debouncedReconnect = _.debounce(reconnect, 2000);
function clearSession () { function clearSession () {
if (!_.isUndefined(_converse.session)) { if (_converse.session !== undefined) {
_converse.session.destroy(); _converse.session.destroy();
delete _converse.session; delete _converse.session;
} }
...@@ -740,10 +740,10 @@ function cleanup () { ...@@ -740,10 +740,10 @@ function cleanup () {
_converse.initialize = async function (settings, callback) { _converse.initialize = async function (settings, callback) {
settings = !_.isUndefined(settings) ? settings : {}; settings = settings !== undefined ? settings : {};
const init_promise = u.getResolveablePromise(); const init_promise = u.getResolveablePromise();
PROMISES.forEach(addPromise); PROMISES.forEach(addPromise);
if (!_.isUndefined(_converse.connection)) { if (_converse.connection !== undefined) {
cleanup(); cleanup();
} }
...@@ -782,7 +782,7 @@ _converse.initialize = async function (settings, callback) { ...@@ -782,7 +782,7 @@ _converse.initialize = async function (settings, callback) {
}); });
/* Localisation */ /* Localisation */
if (!_.isUndefined(i18n)) { if (i18n !== undefined) {
i18n.setLocales(settings.i18n, _converse); i18n.setLocales(settings.i18n, _converse);
} else { } else {
_converse.locale = 'en'; _converse.locale = 'en';
...@@ -977,7 +977,7 @@ _converse.initialize = async function (settings, callback) { ...@@ -977,7 +977,7 @@ _converse.initialize = async function (settings, callback) {
return _converse.finishDisconnection(); return _converse.finishDisconnection();
} }
} else if (_converse.disconnection_cause === _converse.LOGOUT || } else if (_converse.disconnection_cause === _converse.LOGOUT ||
(!_.isUndefined(reason) && reason === _.get(Strophe, 'ErrorCondition.NO_AUTH_MECH')) || (reason !== undefined && reason === _.get(Strophe, 'ErrorCondition.NO_AUTH_MECH')) ||
reason === "host-unknown" || reason === "host-unknown" ||
reason === "remote-connection-failed" || reason === "remote-connection-failed" ||
!_converse.auto_reconnect) { !_converse.auto_reconnect) {
...@@ -991,10 +991,10 @@ _converse.initialize = async function (settings, callback) { ...@@ -991,10 +991,10 @@ _converse.initialize = async function (settings, callback) {
/* Used to keep track of why we got disconnected, so that we can /* Used to keep track of why we got disconnected, so that we can
* decide on what the next appropriate action is (in onDisconnected) * decide on what the next appropriate action is (in onDisconnected)
*/ */
if (_.isUndefined(cause)) { if (cause === undefined) {
delete _converse.disconnection_cause; delete _converse.disconnection_cause;
delete _converse.disconnection_reason; delete _converse.disconnection_reason;
} else if (_.isUndefined(_converse.disconnection_cause) || override) { } else if (_converse.disconnection_cause === undefined || override) {
_converse.disconnection_cause = cause; _converse.disconnection_cause = cause;
_converse.disconnection_reason = reason; _converse.disconnection_reason = reason;
} }
...@@ -1049,7 +1049,7 @@ _converse.initialize = async function (settings, callback) { ...@@ -1049,7 +1049,7 @@ _converse.initialize = async function (settings, callback) {
if (message === "host-unknown" || message == "remote-connection-failed") { if (message === "host-unknown" || message == "remote-connection-failed") {
feedback = __("Sorry, we could not connect to the XMPP host with domain: %1$s", feedback = __("Sorry, we could not connect to the XMPP host with domain: %1$s",
`\"${Strophe.getDomainFromJid(_converse.connection.jid)}\"`); `\"${Strophe.getDomainFromJid(_converse.connection.jid)}\"`);
} else if (!_.isUndefined(message) && message === _.get(Strophe, 'ErrorCondition.NO_AUTH_MECH')) { } else if (message !== undefined && message === _.get(Strophe, 'ErrorCondition.NO_AUTH_MECH')) {
feedback = __("The XMPP server did not offer a supported authentication mechanism"); feedback = __("The XMPP server did not offer a supported authentication mechanism");
} }
_converse.setConnectionStatus(status, feedback); _converse.setConnectionStatus(status, feedback);
...@@ -1087,7 +1087,7 @@ _converse.initialize = async function (settings, callback) { ...@@ -1087,7 +1087,7 @@ _converse.initialize = async function (settings, callback) {
this.initStatus = (reconnecting) => { this.initStatus = (reconnecting) => {
// If there's no xmppstatus obj, then we were never connected to // If there's no xmppstatus obj, then we were never connected to
// begin with, so we set reconnecting to false. // begin with, so we set reconnecting to false.
reconnecting = _.isUndefined(_converse.xmppstatus) ? false : reconnecting; reconnecting = _converse.xmppstatus === undefined ? false : reconnecting;
if (reconnecting) { if (reconnecting) {
_converse.onStatusInitialized(reconnecting); _converse.onStatusInitialized(reconnecting);
} else { } else {
...@@ -1306,7 +1306,7 @@ _converse.initialize = async function (settings, callback) { ...@@ -1306,7 +1306,7 @@ _converse.initialize = async function (settings, callback) {
if (_converse.isTestEnv()) { if (_converse.isTestEnv()) {
await finishInitialization(); await finishInitialization();
return _converse; return _converse;
} else if (!_.isUndefined(i18n)) { } else if (i18n !== undefined) {
const url = u.interpolate(_converse.locales_url, {'locale': _converse.locale}); const url = u.interpolate(_converse.locales_url, {'locale': _converse.locale});
try { try {
await i18n.fetchTranslations(_converse.locale, _converse.locales, url); await i18n.fetchTranslations(_converse.locale, _converse.locales, url);
...@@ -1457,7 +1457,7 @@ _converse.api = { ...@@ -1457,7 +1457,7 @@ _converse.api = {
_converse.trigger.apply(_converse, arguments); _converse.trigger.apply(_converse, arguments);
} }
const promise = _converse.promises[name]; const promise = _converse.promises[name];
if (!_.isUndefined(promise)) { if (promise !== undefined) {
promise.resolve(); promise.resolve();
} }
}, },
...@@ -1517,7 +1517,7 @@ _converse.api = { ...@@ -1517,7 +1517,7 @@ _converse.api = {
logout () { logout () {
clearSession(); clearSession();
_converse.setDisconnectionCause(_converse.LOGOUT, undefined, true); _converse.setDisconnectionCause(_converse.LOGOUT, undefined, true);
if (!_.isUndefined(_converse.connection)) { if (_converse.connection !== undefined) {
_converse.connection.disconnect(); _converse.connection.disconnect();
} else { } else {
tearDown(); tearDown();
...@@ -1804,7 +1804,7 @@ _converse.api = { ...@@ -1804,7 +1804,7 @@ _converse.api = {
return u.waitUntil(condition); return u.waitUntil(condition);
} else { } else {
const promise = _converse.promises[condition]; const promise = _converse.promises[condition];
if (_.isUndefined(promise)) { if (promise === undefined) {
return null; return null;
} }
return promise; return promise;
...@@ -1914,7 +1914,7 @@ const converse = { ...@@ -1914,7 +1914,7 @@ const converse = {
*/ */
add (name, plugin) { add (name, plugin) {
plugin.__name__ = name; plugin.__name__ = name;
if (!_.isUndefined(_converse.pluggable.plugins[name])) { if (_converse.pluggable.plugins[name] !== undefined) {
throw new TypeError( throw new TypeError(
`Error: plugin with name "${name}" has already been ` + 'registered!' `Error: plugin with name "${name}" has already been ` + 'registered!'
); );
......
...@@ -161,7 +161,7 @@ converse.plugins.add('converse-disco', { ...@@ -161,7 +161,7 @@ converse.plugins.add('converse-disco', {
return; return;
} }
const jid = item.getAttribute('jid'); const jid = item.getAttribute('jid');
if (_.isUndefined(this.items.get(jid))) { if (this.items.get(jid) === undefined) {
const entity = _converse.disco_entities.get(jid); const entity = _converse.disco_entities.get(jid);
if (entity) { if (entity) {
this.items.add(entity); this.items.add(entity);
......
...@@ -200,7 +200,7 @@ converse.plugins.add('converse-mam', { ...@@ -200,7 +200,7 @@ converse.plugins.add('converse-mam', {
/************************ BEGIN Event Handlers ************************/ /************************ BEGIN Event Handlers ************************/
function getMAMPrefsFromFeature (feature) { function getMAMPrefsFromFeature (feature) {
const prefs = feature.get('preferences') || {}; const prefs = feature.get('preferences') || {};
if (feature.get('var') !== Strophe.NS.MAM || _.isUndefined(_converse.message_archiving)) { if (feature.get('var') !== Strophe.NS.MAM || _converse.message_archiving === undefined) {
return; return;
} }
if (prefs['default'] !== _converse.message_archiving) { if (prefs['default'] !== _converse.message_archiving) {
......
...@@ -862,7 +862,7 @@ converse.plugins.add('converse-muc', { ...@@ -862,7 +862,7 @@ converse.plugins.add('converse-muc', {
* @returns { Promise } A promise which resolves and fails depending on the XMPP server response. * @returns { Promise } A promise which resolves and fails depending on the XMPP server response.
*/ */
setAffiliation (affiliation, members) { setAffiliation (affiliation, members) {
members = members.filter(m => _.isUndefined(m.affiliation) || m.affiliation === affiliation); members = members.filter(m => m.affiliation === undefined || m.affiliation === affiliation);
return Promise.all(members.map(m => this.sendAffiliationIQ(affiliation, m))); return Promise.all(members.map(m => this.sendAffiliationIQ(affiliation, m)));
}, },
...@@ -1039,7 +1039,7 @@ converse.plugins.add('converse-muc', { ...@@ -1039,7 +1039,7 @@ converse.plugins.add('converse-muc', {
'nick': member.nick, 'nick': member.nick,
'jid': member.jid 'jid': member.jid
}); });
if (!_.isUndefined(member.reason)) { if (member.reason !== undefined) {
iq.c("reason", member.reason); iq.c("reason", member.reason);
} }
return _converse.api.sendIQ(iq); return _converse.api.sendIQ(iq);
...@@ -1917,8 +1917,8 @@ converse.plugins.add('converse-muc', { ...@@ -1917,8 +1917,8 @@ converse.plugins.add('converse-muc', {
async fetchMembers () { async fetchMembers () {
const new_members = await this.chatroom.getJidsWithAffiliations(['member', 'owner', 'admin']); const new_members = await this.chatroom.getJidsWithAffiliations(['member', 'owner', 'admin']);
const new_jids = new_members.map(m => m.jid).filter(m => !_.isUndefined(m)); const new_jids = new_members.map(m => m.jid).filter(m => m !== undefined);
const new_nicks = new_members.map(m => !m.jid && m.nick || undefined).filter(m => !_.isUndefined(m)); const new_nicks = new_members.map(m => !m.jid && m.nick || undefined).filter(m => m !== undefined);
const removed_members = this.filter(m => { const removed_members = this.filter(m => {
return ['admin', 'member', 'owner'].includes(m.get('affiliation')) && return ['admin', 'member', 'owner'].includes(m.get('affiliation')) &&
!new_nicks.includes(m.get('nick')) && !new_nicks.includes(m.get('nick')) &&
...@@ -2148,13 +2148,13 @@ converse.plugins.add('converse-muc', { ...@@ -2148,13 +2148,13 @@ converse.plugins.add('converse-muc', {
*/ */
create (jids, attrs={}) { create (jids, attrs={}) {
attrs = _.isString(attrs) ? {'nick': attrs} : (attrs || {}); attrs = _.isString(attrs) ? {'nick': attrs} : (attrs || {});
if (_.isUndefined(attrs.maximize)) { if (attrs.maximize === undefined) {
attrs.maximize = false; attrs.maximize = false;
} }
if (!attrs.nick && _converse.muc_nickname_from_jid) { if (!attrs.nick && _converse.muc_nickname_from_jid) {
attrs.nick = Strophe.getNodeFromJid(_converse.bare_jid); attrs.nick = Strophe.getNodeFromJid(_converse.bare_jid);
} }
if (_.isUndefined(jids)) { if (jids === undefined) {
throw new TypeError('rooms.create: You need to provide at least one JID'); throw new TypeError('rooms.create: You need to provide at least one JID');
} else if (_.isString(jids)) { } else if (_.isString(jids)) {
return createChatRoom(jids, attrs); return createChatRoom(jids, attrs);
...@@ -2223,7 +2223,7 @@ converse.plugins.add('converse-muc', { ...@@ -2223,7 +2223,7 @@ converse.plugins.add('converse-muc', {
*/ */
async open (jids, attrs, force=false) { async open (jids, attrs, force=false) {
await _converse.api.waitUntil('chatBoxesFetched'); await _converse.api.waitUntil('chatBoxesFetched');
if (_.isUndefined(jids)) { if (jids === undefined) {
const err_msg = 'rooms.open: You need to provide at least one JID'; const err_msg = 'rooms.open: You need to provide at least one JID';
_converse.log(err_msg, Strophe.LogLevel.ERROR); _converse.log(err_msg, Strophe.LogLevel.ERROR);
throw(new TypeError(err_msg)); throw(new TypeError(err_msg));
...@@ -2264,10 +2264,10 @@ converse.plugins.add('converse-muc', { ...@@ -2264,10 +2264,10 @@ converse.plugins.add('converse-muc', {
get (jids, attrs, create) { get (jids, attrs, create) {
if (_.isString(attrs)) { if (_.isString(attrs)) {
attrs = {'nick': attrs}; attrs = {'nick': attrs};
} else if (_.isUndefined(attrs)) { } else if (attrs === undefined) {
attrs = {}; attrs = {};
} }
if (_.isUndefined(jids)) { if (jids === undefined) {
const result = []; const result = [];
_converse.chatboxes.each(function (chatbox) { _converse.chatboxes.each(function (chatbox) {
if (chatbox.get('type') === _converse.CHATROOMS_TYPE) { if (chatbox.get('type') === _converse.CHATROOMS_TYPE) {
......
...@@ -40,9 +40,9 @@ converse.plugins.add('converse-ping', { ...@@ -40,9 +40,9 @@ converse.plugins.add('converse-ping', {
if (_.isNil(jid)) { if (_.isNil(jid)) {
jid = Strophe.getDomainFromJid(_converse.bare_jid); jid = Strophe.getDomainFromJid(_converse.bare_jid);
} }
if (_.isUndefined(timeout) ) { timeout = null; } if (timeout === undefined ) { timeout = null; }
if (_.isUndefined(success) ) { success = null; } if (success === undefined ) { success = null; }
if (_.isUndefined(error) ) { error = null; } if (error === undefined ) { error = null; }
if (_converse.connection) { if (_converse.connection) {
const id = _converse.connection.getUniqueId('ping'); const id = _converse.connection.getUniqueId('ping');
const iq = $iq({ const iq = $iq({
...@@ -66,7 +66,7 @@ converse.plugins.add('converse-ping', { ...@@ -66,7 +66,7 @@ converse.plugins.add('converse-ping', {
}; };
_converse.registerPongHandler = function () { _converse.registerPongHandler = function () {
if (!_.isUndefined(_converse.connection.disco)) { if (_converse.connection.disco !== undefined) {
_converse.api.disco.own.features.add(Strophe.NS.PING); _converse.api.disco.own.features.add(Strophe.NS.PING);
} }
return _converse.connection.addHandler(_converse.pong, Strophe.NS.PING, "iq", "get"); return _converse.connection.addHandler(_converse.pong, Strophe.NS.PING, "iq", "get");
......
...@@ -907,7 +907,7 @@ converse.plugins.add('converse-roster', { ...@@ -907,7 +907,7 @@ converse.plugins.add('converse-roster', {
}); });
_converse.unregisterPresenceHandler = function () { _converse.unregisterPresenceHandler = function () {
if (!_.isUndefined(_converse.presence_ref)) { if (_converse.presence_ref !== undefined) {
_converse.connection.deleteHandler(_converse.presence_ref); _converse.connection.deleteHandler(_converse.presence_ref);
delete _converse.presence_ref; delete _converse.presence_ref;
} }
...@@ -917,7 +917,7 @@ converse.plugins.add('converse-roster', { ...@@ -917,7 +917,7 @@ converse.plugins.add('converse-roster', {
/********** Event Handlers *************/ /********** Event Handlers *************/
function updateUnreadCounter (chatbox) { function updateUnreadCounter (chatbox) {
const contact = _converse.roster.findWhere({'jid': chatbox.get('jid')}); const contact = _converse.roster.findWhere({'jid': chatbox.get('jid')});
if (!_.isUndefined(contact)) { if (contact !== undefined) {
contact.save({'num_unread': chatbox.get('num_unread')}); contact.save({'num_unread': chatbox.get('num_unread')});
} }
} }
...@@ -949,7 +949,7 @@ converse.plugins.add('converse-roster', { ...@@ -949,7 +949,7 @@ converse.plugins.add('converse-roster', {
_converse.api.listen.on('afterTearDown', () => { _converse.api.listen.on('afterTearDown', () => {
if (_converse.presences) { if (_converse.presences) {
_converse.presences.each(p => { _converse.presences.each(p => {
_.each(p.resources.reject(_.isUndefined), r => r.destroy({'silent': true})); p.resources.reject(r => r === undefined).forEach(r => r.destroy({'silent': true}));
p.save({'show': 'offline'}, {'silent': true}) p.save({'show': 'offline'}, {'silent': true})
}); });
} }
...@@ -1049,7 +1049,7 @@ converse.plugins.add('converse-roster', { ...@@ -1049,7 +1049,7 @@ converse.plugins.add('converse-roster', {
async get (jids) { async get (jids) {
await _converse.api.waitUntil('rosterContactsFetched'); await _converse.api.waitUntil('rosterContactsFetched');
const _getter = jid => _converse.roster.get(Strophe.getBareJidFromJid(jid)); const _getter = jid => _converse.roster.get(Strophe.getBareJidFromJid(jid));
if (_.isUndefined(jids)) { if (jids === undefined) {
jids = _converse.roster.pluck('jid'); jids = _converse.roster.pluck('jid');
} else if (_.isString(jids)) { } else if (_.isString(jids)) {
return _getter(jids); return _getter(jids);
......
...@@ -173,7 +173,7 @@ u.applyUserSettings = function applyUserSettings (context, settings, user_settin ...@@ -173,7 +173,7 @@ u.applyUserSettings = function applyUserSettings (context, settings, user_settin
* add settings which are whitelisted. * add settings which are whitelisted.
*/ */
for (var k in settings) { for (var k in settings) {
if (_.isUndefined(user_settings[k])) { if (user_settings[k] === undefined) {
continue; continue;
} }
if (_.isObject(settings[k]) && !Array.isArray(settings[k])) { if (_.isObject(settings[k]) && !Array.isArray(settings[k])) {
......
...@@ -204,7 +204,7 @@ u.getEmojisByCategory = function (_converse) { ...@@ -204,7 +204,7 @@ u.getEmojisByCategory = function (_converse) {
/* Return a dict of emojis with the categories as keys and /* Return a dict of emojis with the categories as keys and
* lists of emojis in that category as values. * lists of emojis in that category as values.
*/ */
if (_.isUndefined(_converse.emojis_by_category)) { if (_converse.emojis_by_category === undefined) {
const emojis = Object.values(_.mapValues(emoji_list, function (value, key, o) { const emojis = Object.values(_.mapValues(emoji_list, function (value, key, o) {
value._shortname = key; value._shortname = key;
return value return value
......
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