From aab726bac42b347e553cd444677b437c36a4d1c5 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Sat, 11 Jul 2015 20:31:55 -0400 Subject: [PATCH] fixes #3313 --- src/controllers/accounts.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/controllers/accounts.js b/src/controllers/accounts.js index 2455b5101b..f09de1ff5f 100644 --- a/src/controllers/accounts.js +++ b/src/controllers/accounts.js @@ -490,6 +490,13 @@ accountsController.getChats = function(req, res, next) { if (parseInt(meta.config.disableChat) === 1) { return helpers.notFound(req, res); } + + // In case a userNAME is passed in instead of a slug, the route should not 404 + var slugified = utils.slugify(req.params.userslug); + if (req.params.userslug !== slugified) { + return res.redirect(nconf.get('relative_path') + '/chats/' + slugified); + } + async.parallel({ contacts: async.apply(user.getFollowing, req.user.uid, 0, 19), recentChats: async.apply(messaging.getRecentChats, req.user.uid, 0, 19)