Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
_converse.router.route(
/^converse\?loglevel=(debug|info|warn|error|fatal)$/, 'loglevel',
l => log.setLogLevel(l)
);
/* Localisation */
if (i18n === undefined || _converse.isTestEnv()) {
_converse.locale = 'en';
} else {
try {
_converse.locale = i18n.getLocale(settings.i18n, _converse.locales);
await i18n.fetchTranslations(_converse);
} catch (e) {
log.fatal(e.message);
}
}
// Module-level variables
// ----------------------
this.callback = callback || function noop () {};
/* When reloading the page:
* For new sessions, we need to send out a presence stanza to notify
* the server/network that we're online.
* When re-attaching to an existing session we don't need to again send out a presence stanza,
* because it's as if "we never left" (see onConnectStatusChanged).
* https://github.com/jcbrand/converse.js/issues/521
*/
this.send_initial_presence = true;
this.user_settings = settings; // Save the user settings so that they can be used by plugins
.catch(e => log.fatal(e));
}
.catch(e => log.fatal(e));
.catch((err) => {
log.fatal(err);
_converse.api.show('error', __('Error'), [
__("Sorry, an error happened while trying to save your profile data."),
__("You can check your browser's developer console for any error output.")
]);
});
this.modal.hide();
async refreshContact (ev) {
if (ev && ev.preventDefault) { ev.preventDefault(); }
const refresh_icon = this.el.querySelector('.fa-refresh');
u.addClass('fa-spin', refresh_icon);
try {
await _converse.api.vcard.update(this.model.contact.vcard, true);
} catch (e) {
log.fatal(e);
this.alert(__('Sorry, something went wrong while trying to refresh'), 'danger');
}
u.removeClass('fa-spin', refresh_icon);
},
}).catch(e => log.fatal(e));
}
onCommandError (err) {
log.fatal(err);
this.showErrorMessage(__("Sorry, an error happened while running the command. Check your browser's developer console for details."));
},