converse-roster: dedupe group names
This commit is contained in:
parent
629f382642
commit
522998bade
|
@ -12,6 +12,7 @@ const { Strophe, $iq, $pres } = converse.env;
|
|||
const RosterContact = Model.extend({
|
||||
defaults: {
|
||||
'chat_state': undefined,
|
||||
'groups': [],
|
||||
'image': _converse.DEFAULT_IMAGE,
|
||||
'image_type': _converse.DEFAULT_IMAGE_TYPE,
|
||||
'num_unread': 0,
|
||||
|
@ -25,7 +26,6 @@ const RosterContact = Model.extend({
|
|||
const bare_jid = Strophe.getBareJidFromJid(jid).toLowerCase();
|
||||
attributes.jid = bare_jid;
|
||||
this.set(Object.assign({
|
||||
'groups': [],
|
||||
'id': bare_jid,
|
||||
'jid': bare_jid,
|
||||
'user_id': Strophe.getNodeFromJid(jid)
|
||||
|
|
|
@ -299,7 +299,7 @@ const RosterContacts = Collection.extend({
|
|||
const contact = this.get(jid);
|
||||
const subscription = item.getAttribute("subscription");
|
||||
const ask = item.getAttribute("ask");
|
||||
const groups = Array.from(item.getElementsByTagName('group')).map(e => e.textContent);
|
||||
const groups = [...new Set(sizzle('group', item).map(e => e.textContent))];
|
||||
if (!contact) {
|
||||
if ((subscription === "none" && ask === null) || (subscription === "remove")) {
|
||||
return; // We're lazy when adding contacts.
|
||||
|
|
Loading…
Reference in New Issue
Block a user