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