Commit f68712a5 authored by JC Brand's avatar JC Brand

Bugfix. Presence stanza sent out before roster initialized

parent 90be11ae
Changelog Changelog
========= =========
0.6.6 (2013-10-08)
------------------
* Bugfix: Presence stanza sent out before roster has been initialized [jcbrand]
0.6.5 (2013-10-08) 0.6.5 (2013-10-08)
------------------ ------------------
......
...@@ -2190,6 +2190,17 @@ ...@@ -2190,6 +2190,17 @@
}, },
rosterHandler: function (items) { rosterHandler: function (items) {
if ((items.length === 0) || (items.length === _.where(items, {subscription:'none'}).length)) {
// The presence stanza is sent out once all
// roster contacts have been added and rendered.
// See RosterView's render method.
//
// If there aren't any roster contacts, we still
// want to send a presence stanza, so we do it here.
converse.xmppstatus.sendPresence();
return true;
}
this.cleanCache(items); this.cleanCache(items);
_.each(items, function (item, index, items) { _.each(items, function (item, index, items) {
if (this.isSelf(item.jid)) { return; } if (this.isSelf(item.jid)) { return; }
...@@ -2359,20 +2370,7 @@ ...@@ -2359,20 +2370,7 @@
} }
this.$el.hide().html(roster_markup); this.$el.hide().html(roster_markup);
this.model.fetch({ this.model.fetch({add: true}); // Get the cached roster items from localstorage
add: true,
success: function (model, resp, options) {
if (resp.length === 0) {
// The presence stanza is sent out once all
// roster contacts have been added and rendered.
// See RosterView's render method.
//
// If there aren't any roster contacts, we still
// want to send a presence stanza, so we do it here.
converse.xmppstatus.sendPresence();
}
}
}); // Get the cached roster items from localstorage
}, },
updateChatBox: function (item, changed) { updateChatBox: function (item, changed) {
......
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