Commit 15093e77 authored by JC Brand's avatar JC Brand

Call render on the roster if an item is removed, to clear headings.

parent e5c44919
...@@ -1629,8 +1629,8 @@ ...@@ -1629,8 +1629,8 @@
this.model.on("remove", function (item) { this.model.on("remove", function (item) {
// remove element from the rosterView instance // remove element from the rosterView instance
this.rosteritemviews[item.id].$el.remove(); this.rosteritemviews[item.id].$el.remove();
delete this.rosteritemviews[item.id]; delete this.rosteritemviews[item.id];
this.render();
}, this); }, this);
this.$el.hide() this.$el.hide()
...@@ -1642,14 +1642,11 @@ ...@@ -1642,14 +1642,11 @@
'<dt id="pending-xmpp-contacts">Pending contacts</dt>'), '<dt id="pending-xmpp-contacts">Pending contacts</dt>'),
render: function (item) { render: function (item) {
if (!item) {
return this;
}
var $my_contacts = this.$el.find('#xmpp-contacts'), var $my_contacts = this.$el.find('#xmpp-contacts'),
$contact_requests = this.$el.find('#xmpp-contact-requests'), $contact_requests = this.$el.find('#xmpp-contact-requests'),
$pending_contacts = this.$el.find('#pending-xmpp-contacts'), $pending_contacts = this.$el.find('#pending-xmpp-contacts'),
$count, presence_change; $count, presence_change;
// TODO see if user_id would be useful if (item) {
var user_id = Strophe.getNodeFromJid(item.id), var user_id = Strophe.getNodeFromJid(item.id),
view = this.rosteritemviews[item.id], view = this.rosteritemviews[item.id],
ask = item.get('ask'), ask = item.get('ask'),
...@@ -1694,6 +1691,7 @@ ...@@ -1694,6 +1691,7 @@
$my_contacts.after($my_contacts.siblings('dd.current-xmpp-contact.unavailable').tsort('a', crit)); $my_contacts.after($my_contacts.siblings('dd.current-xmpp-contact.unavailable').tsort('a', crit));
this.$el.show(); this.$el.show();
} }
}
// Hide the headings if there are no contacts under them // Hide the headings if there are no contacts under them
_.each([$my_contacts, $contact_requests, $pending_contacts], function (h) { _.each([$my_contacts, $contact_requests, $pending_contacts], function (h) {
if (h.nextUntil('dt').length) { if (h.nextUntil('dt').length) {
......
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