3 var recentRoomService = require('gitter-web-rooms/lib/recent-room-service');
6 * For a user who has nowhere to go? Where to Next?
7 * @return promise of a relative URL
9 function whereToNext(user) {
10 return recentRoomService.findInitialRoomUrlForUser(user).then(function(url) {
12 return user.username ? '/' + user.username : '/home/explore';
15 exports.whereToNext = whereToNext;
17 exports.redirectUserToDefaultTroupe = function(req, res, next) {
18 return whereToNext(req.user)
20 var encoded = encodeURI(url);
21 return res.relativeRedirect(encoded);