From 14c79763ddc2fefcfe8b21136bd78473da94724c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Tue, 16 Aug 2022 10:42:33 -0400 Subject: [PATCH] refactor: use group.slug on acp group urls closes #8277 --- src/controllers/admin/groups.js | 4 +++- src/views/admin/manage/groups.tpl | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/controllers/admin/groups.js b/src/controllers/admin/groups.js index e4da58a650..1a7dc950c7 100644 --- a/src/controllers/admin/groups.js +++ b/src/controllers/admin/groups.js @@ -9,6 +9,7 @@ const groups = require('../../groups'); const meta = require('../../meta'); const pagination = require('../../pagination'); const events = require('../../events'); +const slugify = require('../../slugify'); const groupsController = module.exports; @@ -31,7 +32,8 @@ groupsController.list = async function (req, res) { }; groupsController.get = async function (req, res, next) { - const groupName = req.params.name; + const slug = slugify(req.params.name); + const groupName = await groups.getGroupNameByGroupSlug(slug); const [groupNames, group] = await Promise.all([ getGroupNames(), groups.get(groupName, { uid: req.uid, truncateUserList: true, userListCount: 20 }), diff --git a/src/views/admin/manage/groups.tpl b/src/views/admin/manage/groups.tpl index 03a38ec656..25f7b835b5 100644 --- a/src/views/admin/manage/groups.tpl +++ b/src/views/admin/manage/groups.tpl @@ -21,7 +21,7 @@ - {groups.displayName} ({groups.memberCount}) + {groups.displayName} ({groups.memberCount})

{groups.description}