Commit 9965a932 authored by JC Brand's avatar JC Brand

muc: Simplify `getVCardForChatroomOccupant` method

parent e915321e
......@@ -305,26 +305,13 @@ converse.plugins.add('converse-muc', {
if (chatbox && chatbox.get('nick') === nick) {
return _converse.xmppstatus.vcard;
} else {
let vcard;
if (this.get('vcard_jid')) {
vcard = _converse.vcards.findWhere({'jid': this.get('vcard_jid')});
}
if (!vcard) {
let jid;
if (this.occupant && this.occupant.get('jid')) {
jid = this.occupant.get('jid');
this.save({'vcard_jid': jid}, {'silent': true});
} else {
jid = this.get('from');
}
if (jid) {
vcard = _converse.vcards.findWhere({'jid': jid}) || _converse.vcards.create({'jid': jid});
} else {
log.error(`Could not assign VCard for message because no JID found! msgid: ${this.get('msgid')}`);
return;
}
const jid = this.occupant && this.occupant.get('jid') || this.get('from');
if (jid) {
return _converse.vcards.findWhere({jid}) || _converse.vcards.create({jid});
} else {
log.error(`Could not assign VCard for message because no JID found! msgid: ${this.get('msgid')}`);
return;
}
return vcard;
}
},
......
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