Commit 42c3bc2b authored by JC Brand's avatar JC Brand

Bugfix.

With auto_subscribe=True, "Pending Contacts" header didn't disappear
after user was added to the roster.
parent 94637781
Changelog Changelog
========= =========
0.6.2 (Unreleased)
------------------
- Bugfix. The remove icon wasn't appearing in the contacts roster. [jcbrand]
- Bugfix. With auto_subscribe=True, "Pending Contacts" header didn't disappear
after user was added to the roster. [jcbrand]
0.6.1 (2013-08-28) 0.6.1 (2013-08-28)
------------------ ------------------
......
...@@ -1875,6 +1875,12 @@ ...@@ -1875,6 +1875,12 @@
this.$el.html(this.request_template(item.toJSON())); this.$el.html(this.request_template(item.toJSON()));
converse.showControlBox(); converse.showControlBox();
} else if (subscription === 'both' || subscription === 'to') { } else if (subscription === 'both' || subscription === 'to') {
_.each(['pending-xmpp-contact', 'requesting-xmpp-contact'],
function (cls) {
if (this.el.className.indexOf(cls) !== -1) {
this.$el.removeClass(cls);
}
}, this);
this.$el.addClass('current-xmpp-contact'); this.$el.addClass('current-xmpp-contact');
var status_desc = { var status_desc = {
'dnd': 'This contact is busy', 'dnd': 'This contact is busy',
...@@ -2242,7 +2248,8 @@ ...@@ -2242,7 +2248,8 @@
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; sorted = false,
$count, changed_presence;
if (item) { if (item) {
var jid = item.id, var jid = item.id,
view = this.rosteritemviews[item.id], view = this.rosteritemviews[item.id],
...@@ -2263,22 +2270,18 @@ ...@@ -2263,22 +2270,18 @@
$my_contacts.after(view.render().el); $my_contacts.after(view.render().el);
} }
} }
changed_presence = view.model.changed.chat_status;
presence_change = view.model.changed.chat_status; if (changed_presence) {
if (presence_change) { this.sortRoster(changed_presence)
$my_contacts.siblings('dd.current-xmpp-contact.'+presence_change).tsort('a', crit); sorted = true;
$my_contacts.after($my_contacts.siblings('dd.current-xmpp-contact.offline')); }
$my_contacts.after($my_contacts.siblings('dd.current-xmpp-contact.unavailable'));
$my_contacts.after($my_contacts.siblings('dd.current-xmpp-contact.away'));
$my_contacts.after($my_contacts.siblings('dd.current-xmpp-contact.dnd'));
$my_contacts.after($my_contacts.siblings('dd.current-xmpp-contact.online'));
}
if (item.get('is_last')) { if (item.get('is_last')) {
if (!sorted) {
this.sortRoster(item.get('chat_status'));
}
if (!this.$el.is(':visible')) { if (!this.$el.is(':visible')) {
// Once all initial roster items have been added, we // Once all initial roster items have been added, we
// can show the roster. // can show the roster.
this.initialSort();
this.$el.show(); this.$el.show();
} }
converse.xmppstatus.sendPresence(); converse.xmppstatus.sendPresence();
...@@ -2303,11 +2306,14 @@ ...@@ -2303,11 +2306,14 @@
return this; return this;
}, },
initialSort: function () { sortRoster: function (chat_status) {
var $my_contacts = this.$el.find('#xmpp-contacts'), var $my_contacts = this.$el.find('#xmpp-contacts');
crit = {order:'asc'}; $my_contacts.siblings('dd.current-xmpp-contact.'+chat_status).tsort('a', {order:'asc'});
$my_contacts.after($my_contacts.siblings('dd.current-xmpp-contact.offline').tsort('a', crit)); $my_contacts.after($my_contacts.siblings('dd.current-xmpp-contact.offline'));
$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'));
$my_contacts.after($my_contacts.siblings('dd.current-xmpp-contact.away'));
$my_contacts.after($my_contacts.siblings('dd.current-xmpp-contact.dnd'));
$my_contacts.after($my_contacts.siblings('dd.current-xmpp-contact.online'));
} }
}); });
...@@ -2691,9 +2697,8 @@ ...@@ -2691,9 +2697,8 @@
if (this.debug) { if (this.debug) {
this.connection.xmlInput = function (body) { console.log(body); }; this.connection.xmlInput = function (body) { console.log(body); };
this.connection.xmlOutput = function (body) { console.log(body); }; this.connection.xmlOutput = function (body) { console.log(body); };
Strophe.log = function (level, msg) { Strophe.log = function (level, msg) { console.log(level+' '+msg); };
console.log(level+' '+msg); Strophe.error = function (msg) { console.log('ERROR: '+msg); };
};
} }
this.bare_jid = Strophe.getBareJidFromJid(this.connection.jid); this.bare_jid = Strophe.getBareJidFromJid(this.connection.jid);
this.domain = Strophe.getDomainFromJid(this.connection.jid); this.domain = Strophe.getDomainFromJid(this.connection.jid);
......
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