Commit 1705aa8f authored by JC Brand's avatar JC Brand

Bugfix. Handle case where user accepts request.

But other user is not online to quickly subscribe back.
parent 40e767b6
...@@ -2883,7 +2883,12 @@ ...@@ -2883,7 +2883,12 @@
this.$el.addClass(chat_status).data('status', chat_status); this.$el.addClass(chat_status).data('status', chat_status);
if (ask === 'subscribe') { if ((ask === 'subscribe') || (subscription === 'from')) {
// if subscription === 'from', then they are subscribed to
// us, but not vice versa. We assume that there is a
// pending subscription from us to them (otherwise we're in
// a state not supported by converse.js), so the user is a
// "pending" contact.
this.$el.addClass('pending-xmpp-contact'); this.$el.addClass('pending-xmpp-contact');
this.$el.html(converse.templates.pending_contact( this.$el.html(converse.templates.pending_contact(
_.extend(item.toJSON(), { _.extend(item.toJSON(), {
...@@ -3293,7 +3298,7 @@ ...@@ -3293,7 +3298,7 @@
}, },
removeAllRosterItemViews: function () { removeAllRosterItemViews: function () {
var views = this.removeAll(); this.removeAll();
this.updateRoster(); this.updateRoster();
return this; return this;
}, },
...@@ -3334,11 +3339,18 @@ ...@@ -3334,11 +3339,18 @@
if ((ask === 'subscribe') && (subscription == 'none')) { if ((ask === 'subscribe') && (subscription == 'none')) {
$pending_contacts.after(view.render().el); $pending_contacts.after(view.render().el);
$pending_contacts.after($pending_contacts.siblings('dd.pending-xmpp-contact').tsort(crit)); $pending_contacts.after($pending_contacts.siblings('dd.pending-xmpp-contact').tsort(crit));
} else if ((ask === 'subscribe') && (subscription == 'from')) { } else if ((ask === 'subscribe' || ask === null) && (subscription === 'from')) {
// TODO: We have accepted an incoming subscription // We have accepted an incoming subscription
// request and (automatically) made our own subscription request back. // request and (automatically) made our own subscription request back.
// It would be useful to update the roster here to show //
// things are happening... (see docs/DEVELOPER.rst) // From what I can tell: (see docs/DEVELOPER.rst)
// if ask == 'subscribe', then the other user is online.
// if ask == null, then the other user is not online currently.
//
// In either case, the other user is now subscribed to
// us (i.e. "from" them to us), and we have a pending
// subscription to them, so we show the user as a
// pending contact.
$pending_contacts.after(view.render().el); $pending_contacts.after(view.render().el);
$pending_contacts.after($pending_contacts.siblings('dd.pending-xmpp-contact').tsort(crit)); $pending_contacts.after($pending_contacts.siblings('dd.pending-xmpp-contact').tsort(crit));
} else if (requesting === true) { } else if (requesting === true) {
......
...@@ -30,7 +30,7 @@ subscription and subscribes back. ...@@ -30,7 +30,7 @@ subscription and subscribes back.
<presence type="subscribed" to="contact1@localhost"/> <presence type="subscribed" to="contact1@localhost"/>
<presence type="subscribe" to="contact1@localhost"/> <presence type="subscribe" to="contact1@localhost"/>
Contact2 receives a roster update IF Contact1 is still online and likewise subscribes back, Contact2 will receive a roster update
:: ::
<iq type="set" to="contact2@localhost"> <iq type="set" to="contact2@localhost">
...@@ -39,6 +39,13 @@ Contact2 receives a roster update ...@@ -39,6 +39,13 @@ Contact2 receives a roster update
</query> </query>
</iq> </iq>
ELSE, Contact 2 will receive a roster update (but not an IQ stanza)
::
ask = null
subscription = "from"
Contact1's converse.js client will automatically Contact1's converse.js client will automatically
approve. approve.
......
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