From 735b9ca08f18bd5f38721c104e65a523ad82c57a Mon Sep 17 00:00:00 2001 From: Sebastien Hut Date: Wed, 10 Dec 2014 11:25:19 +0100 Subject: [PATCH] Fix: JID in URI --- clientapp/models/call.js | 2 +- clientapp/models/contact.js | 2 +- clientapp/models/muc.js | 2 +- clientapp/router.js | 4 ++-- clientapp/views/call.js | 2 +- clientapp/views/contactListItem.js | 4 ++-- clientapp/views/mucListItem.js | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/clientapp/models/call.js b/clientapp/models/call.js index 63c650d..89806f3 100644 --- a/clientapp/models/call.js +++ b/clientapp/models/call.js @@ -11,7 +11,7 @@ module.exports = HumanModel.define({ initialize: function (attrs) { this.contact.onCall = true; // temporary, this won't stay here - app.navigate('/chat/' + this.contact.jid); + app.navigate('/chat/' + encodeURIComponent(this.contact.jid)); }, session: { contact: 'object', diff --git a/clientapp/models/contact.js b/clientapp/models/contact.js index e348ee6..7443807 100644 --- a/clientapp/models/contact.js +++ b/clientapp/models/contact.js @@ -261,7 +261,7 @@ module.exports = HumanModel.define({ body: message.body, icon: this.avatar, tag: this.jid, - onclick: _.bind(app.navigate, app, '/chat/' + this.jid) + onclick: _.bind(app.navigate, app, '/chat/' + encodeURIComponent(this.jid)) }); } diff --git a/clientapp/models/muc.js b/clientapp/models/muc.js index 87acb27..dd63816 100644 --- a/clientapp/models/muc.js +++ b/clientapp/models/muc.js @@ -96,7 +96,7 @@ module.exports = HumanModel.define({ body: message.body, icon: this.avatar, tag: this.id, - onclick: _.bind(app.navigate, app, '/groupchat/' + this.jid) + onclick: _.bind(app.navigate, app, '/groupchat/' + encodeURIComponent(this.jid)) }); } } diff --git a/clientapp/router.js b/clientapp/router.js index aaa2e02..219eddc 100644 --- a/clientapp/router.js +++ b/clientapp/router.js @@ -22,7 +22,7 @@ module.exports = Backbone.Router.extend({ })); }, chat: function (jid) { - var contact = me.contacts.get(jid); + var contact = me.contacts.get(decodeURIComponent(jid)); if (contact) { app.renderPage(new ChatPage({ model: contact @@ -32,7 +32,7 @@ module.exports = Backbone.Router.extend({ } }, groupchat: function (jid) { - var contact = me.mucs.get(jid); + var contact = me.mucs.get(decodeURIComponent(jid)); if (contact) { app.renderPage(new GroupChatPage({ model: contact diff --git a/clientapp/views/call.js b/clientapp/views/call.js index a468535..22b58f7 100644 --- a/clientapp/views/call.js +++ b/clientapp/views/call.js @@ -38,7 +38,7 @@ module.exports = HumanView.extend({ e.preventDefault(); var self = this; self.model.state = 'active'; - app.navigate('/chat/' + self.model.contact.jid); + app.navigate('/chat/' + encodeURIComponent(self.model.contact.jid)); self.model.contact.onCall = true; self.model.jingleSession.accept(); return false; diff --git a/clientapp/views/contactListItem.js b/clientapp/views/contactListItem.js index d555734..b936ba3 100644 --- a/clientapp/views/contactListItem.js +++ b/clientapp/views/contactListItem.js @@ -33,12 +33,12 @@ module.exports = HumanView.extend({ }, handleClick: function () { if (me.contacts.get(this.model.jid)) { - app.navigate('chat/' + this.model.jid); + app.navigate('chat/' + encodeURIComponent(this.model.jid)); } }, handleRemoveContact: function() { me.removeContact(this.model.jid); - if (app.history.fragment === 'chat/' + this.model.jid) { + if (app.history.fragment === 'chat/' + encodeURIComponent(this.model.jid)) { app.navigate('/'); } } diff --git a/clientapp/views/mucListItem.js b/clientapp/views/mucListItem.js index b889033..65d25d6 100644 --- a/clientapp/views/mucListItem.js +++ b/clientapp/views/mucListItem.js @@ -28,7 +28,7 @@ module.exports = HumanView.extend({ return this; }, handleClick: function (e) { - app.navigate('groupchat/' + this.model.jid); + app.navigate('groupchat/' + encodeURIComponent(this.model.jid)); }, handleJoinRoom: function (e) { this.model.join();