summary refs log tree commit diff
diff options
context:
space:
mode:
authorThe Arcane Brony <myrainbowdash949@gmail.com>2021-10-01 22:43:58 +0200
committerThe Arcane Brony <myrainbowdash949@gmail.com>2021-10-01 22:43:58 +0200
commit2cd210cb7cbd001269316d3b6ecbbe61d7bd3471 (patch)
treeed4d5e29a9edef940155fe5dd6ec5ee1f573a712
parentAdd setting to show all guilds in discovery, fix query for guild discovery (diff)
downloadserver-2cd210cb7cbd001269316d3b6ecbbe61d7bd3471.tar.xz
Add default value to guild discovery"
Diffstat (limited to '')
-rw-r--r--api/src/routes/discoverable-guilds.ts3
1 files changed, 1 insertions, 2 deletions
diff --git a/api/src/routes/discoverable-guilds.ts b/api/src/routes/discoverable-guilds.ts
index 509abc9e..b626b084 100644
--- a/api/src/routes/discoverable-guilds.ts
+++ b/api/src/routes/discoverable-guilds.ts
@@ -9,11 +9,10 @@ const router = Router();
 router.get("/", route({}), async (req: Request, res: Response) => {
 	const { limit } = req.params;
 	var showAllGuilds = Config.get().guild.showAllGuildsInDiscovery;
-
 	// ! this only works using SQL querys
 	// TODO: implement this with default typeorm query
 	// const guilds = await Guild.find({ where: { features: "DISCOVERABLE" } }); //, take: Math.abs(Number(limit)) });
-	const guilds = showAllGuilds ? await Guild.find({take: Math.abs(Number(limit))}) : await Guild.find({ where: `"features" LIKE '%COMMUNITY%'`, take: Math.abs(Number(limit)) });
+	const guilds = showAllGuilds ? await Guild.find({take: Math.abs(Number(limit || 20))}) : await Guild.find({ where: `"features" LIKE '%COMMUNITY%'`, take: Math.abs(Number(limit || 20)) });
 	res.send({ guilds: guilds });
 });