Commit 0d8d99b8 authored by JC Brand's avatar JC Brand

Bugfix. vcard doesn't necessarily have jid

parent b154d6d5
...@@ -103,6 +103,7 @@ ...@@ -103,6 +103,7 @@
this.messages = new _converse.Messages(); this.messages = new _converse.Messages();
this.messages.browserStorage = new Backbone.BrowserStorage[_converse.message_storage]( this.messages.browserStorage = new Backbone.BrowserStorage[_converse.message_storage](
b64_sha1(`converse.messages${this.get('jid')}${_converse.bare_jid}`)); b64_sha1(`converse.messages${this.get('jid')}${_converse.bare_jid}`));
this.save({ this.save({
// The chat_state will be set to ACTIVE once the chat box is opened // The chat_state will be set to ACTIVE once the chat box is opened
// and we listen for change:chat_state, so shouldn't set it to ACTIVE here. // and we listen for change:chat_state, so shouldn't set it to ACTIVE here.
......
...@@ -80,12 +80,13 @@ ...@@ -80,12 +80,13 @@
function updateChatBoxFromVCard (_converse, jid) { function updateChatBoxFromVCard (_converse, jid) {
_converse.api.vcard.get(jid) _converse.api.vcard.get(jid)
.then((vcard) => { .then((vcard) => {
const chatbox = _converse.chatboxes.getChatBox(vcard.jid); const chatbox = _converse.chatboxes.getChatBox(jid);
if (!_.isUndefined(chatbox)) { if (!_.isUndefined(chatbox)) {
chatbox.save(_.pick(vcard, ['fullname', 'url', 'image_type', 'image', 'vcard_updated'])); chatbox.save(_.pick(vcard, ['fullname', 'url', 'image_type', 'image', 'vcard_updated']));
} }
}) })
.catch(() => { .catch((e) => {
_converse.log(e, Strophe.LogLevel.ERROR);
_converse.log( _converse.log(
"updateChatBoxFromVCard: Error occured while attempting to update chatbox with VCard data", "updateChatBoxFromVCard: Error occured while attempting to update chatbox with VCard data",
Strophe.LogLevel.ERROR Strophe.LogLevel.ERROR
......
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