Commit dd505ad9 authored by JC Brand's avatar JC Brand

More fixes now that we don't store the JID under 'fullname'

if the fullname is not available.
parent cbc48629
...@@ -1206,12 +1206,12 @@ ...@@ -1206,12 +1206,12 @@
this.sendContactAddIQ(jid, name, groups, this.sendContactAddIQ(jid, name, groups,
() => { () => {
const contact = this.create(_.assignIn({ const contact = this.create(_.assignIn({
ask: undefined, 'ask': undefined,
fullname: name, 'fullname': name,
groups, groups,
jid, jid,
requesting: false, 'requesting': false,
subscription: 'none' 'subscription': 'none'
}, attributes), {sort: false}); }, attributes), {sort: false});
resolve(contact); resolve(contact);
}, },
......
...@@ -186,7 +186,7 @@ ...@@ -186,7 +186,7 @@
xhr.onload = function () { xhr.onload = function () {
if (xhr.responseText) { if (xhr.responseText) {
awesomplete.list = JSON.parse(xhr.responseText).map((i) => { //eslint-disable-line arrow-body-style awesomplete.list = JSON.parse(xhr.responseText).map((i) => { //eslint-disable-line arrow-body-style
return {'label': i.fullname, 'value': i.jid}; return {'label': i.fullname || i.jid, 'value': i.jid};
}); });
awesomplete.evaluate(); awesomplete.evaluate();
} }
...@@ -416,7 +416,7 @@ ...@@ -416,7 +416,7 @@
this.el.classList.add('pending-xmpp-contact'); this.el.classList.add('pending-xmpp-contact');
this.el.innerHTML = tpl_pending_contact( this.el.innerHTML = tpl_pending_contact(
_.extend(item.toJSON(), { _.extend(item.toJSON(), {
'desc_remove': __('Click to remove %1$s as a contact', item.get('fullname')), 'desc_remove': __('Click to remove %1$s as a contact', item.get('fullname') || item.get('jid')),
'allow_chat_pending_contacts': _converse.allow_chat_pending_contacts 'allow_chat_pending_contacts': _converse.allow_chat_pending_contacts
}) })
); );
...@@ -424,8 +424,8 @@ ...@@ -424,8 +424,8 @@
this.el.classList.add('requesting-xmpp-contact'); this.el.classList.add('requesting-xmpp-contact');
this.el.innerHTML = tpl_requesting_contact( this.el.innerHTML = tpl_requesting_contact(
_.extend(item.toJSON(), { _.extend(item.toJSON(), {
'desc_accept': __("Click to accept the contact request from %1$s", item.get('fullname')), 'desc_accept': __("Click to accept the contact request from %1$s", item.get('fullname') || item.get('jid')),
'desc_decline': __("Click to decline the contact request from %1$s", item.get('fullname')), 'desc_decline': __("Click to decline the contact request from %1$s", item.get('fullname') || item.get('jid')),
'allow_chat_pending_contacts': _converse.allow_chat_pending_contacts 'allow_chat_pending_contacts': _converse.allow_chat_pending_contacts
}) })
); );
...@@ -454,8 +454,8 @@ ...@@ -454,8 +454,8 @@
_.extend(item.toJSON(), { _.extend(item.toJSON(), {
'desc_status': STATUSES[chat_status], 'desc_status': STATUSES[chat_status],
'status_icon': status_icon, 'status_icon': status_icon,
'desc_chat': __('Click to chat with %1$s (JID: %2$s)', item.get('fullname'), item.get('jid')), 'desc_chat': __('Click to chat with %1$s (JID: %2$s)', item.get('fullname') || item.get('jid'), item.get('jid')),
'desc_remove': __('Click to remove %1$s as a contact', item.get('fullname')), 'desc_remove': __('Click to remove %1$s as a contact', item.get('fullname') || item.get('jid')),
'allow_contact_removal': _converse.allow_contact_removal, 'allow_contact_removal': _converse.allow_contact_removal,
'num_unread': item.get('num_unread') || 0 'num_unread': item.get('num_unread') || 0
}) })
...@@ -633,9 +633,10 @@ ...@@ -633,9 +633,10 @@
); );
} }
} else { } else {
matches = this.model.contacts.filter( matches = this.model.contacts.filter((contact) => {
u.contains.not('fullname', q) const value = contact.get('fullname') || contact.get('jid');
); return _.includes(value.toLowerCase(), q.toLowerCase());
});
} }
return matches; return matches;
}, },
......
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