fix chat redirect

v1.18.x
barisusakli 9 years ago
parent f6fa0ace3c
commit b556652582

@ -222,9 +222,7 @@ $(document).ready(function() {
$(window).trigger('action:ajaxify.dataLoaded', {url: url, data: data}); $(window).trigger('action:ajaxify.dataLoaded', {url: url, data: data});
if (callback) {
callback(null, data); callback(null, data);
}
}, },
error: function(data, textStatus) { error: function(data, textStatus) {
if (data.status === 0 && textStatus === 'error') { if (data.status === 0 && textStatus === 'error') {

@ -140,7 +140,7 @@ define('forum/chats', ['components', 'string', 'sounds', 'forum/infinitescroll',
Chats.switchChat = function(uid, username) { Chats.switchChat = function(uid, username) {
if (!$('[component="chat/messages"]').length) { if (!$('[component="chat/messages"]').length) {
ajaxify.go('chats/' + username); return ajaxify.go('chats/' + utils.slugify(username));
} }
var contactEl = $('.chats-list [data-uid="' + uid + '"]'); var contactEl = $('.chats-list [data-uid="' + uid + '"]');

@ -19,7 +19,7 @@ chatsController.get = function(req, res, callback) {
// In case a userNAME is passed in instead of a slug, the route should not 404 // In case a userNAME is passed in instead of a slug, the route should not 404
var slugified = utils.slugify(req.params.userslug); var slugified = utils.slugify(req.params.userslug);
if (req.params.userslug && req.params.userslug !== slugified) { if (req.params.userslug && req.params.userslug !== slugified) {
return res.redirect(nconf.get('relative_path') + '/chats/' + slugified); return helpers.redirect(res, '/chats/' + slugified);
} }
async.parallel({ async.parallel({

Loading…
Cancel
Save