Save groups on RosterItem. updates #83

This commit is contained in:
JC Brand 2014-07-14 21:44:18 +02:00
parent 6bded11304
commit 01c2c5d93c

View File

@ -3060,21 +3060,28 @@
return; return;
} }
this.create({ this.create({
jid: item.jid,
subscription: item.subscription,
ask: item.ask, ask: item.ask,
fullname: item.name || item.jid, fullname: item.name || item.jid,
is_last: is_last groups: item.groups,
is_last: is_last,
jid: item.jid,
subscription: item.subscription
}); });
} else { } else {
if ((item.subscription === 'none') && (item.ask === null)) { if ((item.subscription === 'none') && (item.ask === null)) {
// This user is no longer in our roster // This user is no longer in our roster
model.destroy(); model.destroy();
} else if (model.get('subscription') !== item.subscription || model.get('ask') !== item.ask) { } else {
// only modify model attributes if they are different from the // We only find out about requesting contacts via the
// ones that were already set when the rosterItem was added // presence handler, so if we receive a contact
model.set({'subscription': item.subscription, 'ask': item.ask, 'requesting': null}); // here, we know they aren't requesting anymore.
model.save(); // see docs/DEVELOPER.rst
model.save({
subscription: item.subscription,
ask: item.ask,
requesting: null,
groups: item.groups
});
} }
} }
}, this); }, this);