Commit 680f3041 authored by JC Brand's avatar JC Brand

Bugfix. Object values for `defaults` passed-by-reference

parent 055c4d21
...@@ -451,6 +451,8 @@ ...@@ -451,6 +451,8 @@
_converse.LoginPanelModel = Backbone.Model.extend({ _converse.LoginPanelModel = Backbone.Model.extend({
defaults: { defaults: {
// Passed-by-reference. Fine in this case because there's
// only one such model.
'errors': [], 'errors': [],
} }
}); });
......
...@@ -857,10 +857,8 @@ ...@@ -857,10 +857,8 @@
this.RosterContact = Backbone.Model.extend({ this.RosterContact = Backbone.Model.extend({
defaults: { defaults: {
'bookmarked': false,
'chat_state': undefined, 'chat_state': undefined,
'chat_status': 'offline', 'chat_status': 'offline',
'groups': [],
'image': _converse.DEFAULT_IMAGE, 'image': _converse.DEFAULT_IMAGE,
'image_type': _converse.DEFAULT_IMAGE_TYPE, 'image_type': _converse.DEFAULT_IMAGE_TYPE,
'num_unread': 0, 'num_unread': 0,
...@@ -873,11 +871,12 @@ ...@@ -873,11 +871,12 @@
const resource = Strophe.getResourceFromJid(jid); const resource = Strophe.getResourceFromJid(jid);
attributes.jid = bare_jid; attributes.jid = bare_jid;
this.set(_.assignIn({ this.set(_.assignIn({
'fullname': bare_jid,
'groups': [],
'id': bare_jid, 'id': bare_jid,
'jid': bare_jid, 'jid': bare_jid,
'fullname': bare_jid, 'resources': {},
'user_id': Strophe.getNodeFromJid(jid), 'user_id': Strophe.getNodeFromJid(jid)
'resources': resource ? {resource :0} : {},
}, attributes)); }, attributes));
this.on('destroy', () => { this.removeFromRoster(); }); this.on('destroy', () => { this.removeFromRoster(); });
......
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