From 240a619a7268179b0d070058d7b4d8ea546008d0 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Sat, 12 Sep 2015 00:13:25 -0400 Subject: [PATCH] pretty group breadcrumbs --- src/controllers/groups.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/controllers/groups.js b/src/controllers/groups.js index 72150cdf79..e7602f85e9 100644 --- a/src/controllers/groups.js +++ b/src/controllers/groups.js @@ -2,6 +2,7 @@ var async = require('async'), nconf = require('nconf'), + validator = require('validator'), db = require('../database'), meta = require('../meta'), groups = require('../groups'), @@ -91,18 +92,20 @@ groupsController.details = function(req, res, callback) { } results.title = '[[pages:group, ' + results.group.displayName + ']]'; - results.breadcrumbs = helpers.buildBreadcrumbs([{text: '[[pages:groups]]', url: '/groups' }, {text: results.group.slug}]); + results.breadcrumbs = helpers.buildBreadcrumbs([{text: '[[pages:groups]]', url: '/groups' }, {text: results.group.displayName}]); res.render('groups/details', results); }); }); }; groupsController.members = function(req, res, next) { + var groupName; async.waterfall([ function(next) { groups.getGroupNameByGroupSlug(req.params.slug, next); }, - function(groupName, next) { + function(_groupName, next) { + groupName = _groupName; user.getUsersFromSet('group:' + groupName + ':members', req.uid, 0, 49, next); }, ], function(err, users) { @@ -112,7 +115,7 @@ groupsController.members = function(req, res, next) { var breadcrumbs = helpers.buildBreadcrumbs([ {text: '[[pages:groups]]', url: '/groups' }, - {text: req.params.slug, url: '/groups/' + req.params.slug}, + {text: validator.escape(groupName), url: '/groups/' + req.params.slug}, {text: '[[groups:details.members]]'} ]);