Commit 01888b9b authored by JC Brand's avatar JC Brand

vcard: Properly handle case where FN is empty in VCard

parent eed936ff
...@@ -82,15 +82,14 @@ ...@@ -82,15 +82,14 @@
const vcard = iq.querySelector('vCard'), const vcard = iq.querySelector('vCard'),
img_type = _.get(vcard.querySelector('TYPE'), 'textContent'), img_type = _.get(vcard.querySelector('TYPE'), 'textContent'),
img = _.get(vcard.querySelector('BINVAL'), 'textContent'), img = _.get(vcard.querySelector('BINVAL'), 'textContent'),
url = _.get(vcard.querySelector('URL'), 'textContent'); url = _.get(vcard.querySelector('URL'), 'textContent'),
fullname = _.get(vcard.querySelector('FN'), 'textContent');
let fullname = _.get(vcard.querySelector('FN'), 'textContent');
if (jid) { if (jid) {
const contact = _converse.roster.get(jid); const contact = _converse.roster.get(jid);
if (contact) { if (contact) {
fullname = _.isUndefined(fullname) ? _.get(contact, 'fullname', jid) : fullname;
contact.save({ contact.save({
'fullname': fullname, 'fullname': fullname || _.get(contact, 'fullname', jid),
'image_type': img_type, 'image_type': img_type,
'image': img, 'image': img,
'url': url, 'url': url,
......
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