mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
refactor: use groupslug:groupname for search and acp page
dont need to load all names which includes privilege groups
This commit is contained in:
@@ -62,14 +62,13 @@ groupsController.get = async function (req, res, next) {
|
||||
};
|
||||
|
||||
async function getGroupNames() {
|
||||
const groupNames = await db.getSortedSetRange('groups:createtime', 0, -1);
|
||||
const groupNames = Object.values(await db.getObject('groupslug:groupname'));
|
||||
return groupNames.filter(name => (
|
||||
name !== 'registered-users' &&
|
||||
name !== 'verified-users' &&
|
||||
name !== 'unverified-users' &&
|
||||
name !== groups.BANNED_USERS &&
|
||||
!groups.isPrivilegeGroup(name)
|
||||
));
|
||||
name !== groups.BANNED_USERS
|
||||
)).sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()));
|
||||
}
|
||||
|
||||
groupsController.getCSV = async function (req, res) {
|
||||
|
||||
@@ -9,13 +9,13 @@ module.exports = function (Groups) {
|
||||
return [];
|
||||
}
|
||||
query = String(query).toLowerCase();
|
||||
let groupNames = await db.getSortedSetRange('groups:createtime', 0, -1);
|
||||
let groupNames = Object.values(await db.getObject('groupslug:groupname'));
|
||||
if (!options.hideEphemeralGroups) {
|
||||
groupNames = Groups.ephemeralGroups.concat(groupNames);
|
||||
}
|
||||
groupNames = groupNames.filter(name => name.toLowerCase().includes(query) &&
|
||||
name !== Groups.BANNED_USERS && // hide banned-users in searches
|
||||
!Groups.isPrivilegeGroup(name));
|
||||
groupNames = groupNames.filter(
|
||||
name => name.toLowerCase().includes(query) && name !== Groups.BANNED_USERS // hide banned-users in searches
|
||||
);
|
||||
groupNames = groupNames.slice(0, 100);
|
||||
|
||||
let groupsData;
|
||||
|
||||
Reference in New Issue
Block a user