mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
test: fix crash due to excludeGroups
This commit is contained in:
@@ -9,6 +9,7 @@ module.exports = function (Groups) {
|
||||
return [];
|
||||
}
|
||||
query = String(query).toLowerCase();
|
||||
const excludeGroups = Array.isArray(options.excludeGroups) ? options.excludeGroups : [];
|
||||
let groupNames = Object.values(await db.getObject('groupslug:groupname'));
|
||||
if (!options.hideEphemeralGroups) {
|
||||
groupNames = Groups.ephemeralGroups.concat(groupNames);
|
||||
@@ -16,7 +17,7 @@ module.exports = function (Groups) {
|
||||
groupNames = groupNames.filter(
|
||||
name => name.toLowerCase().includes(query) &&
|
||||
name !== Groups.BANNED_USERS && // hide banned-users in searches
|
||||
!options.excludeGroups.includes(name)
|
||||
!excludeGroups.includes(name)
|
||||
);
|
||||
groupNames = groupNames.slice(0, 100);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user