summary refs log tree commit diff
path: root/src/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/api')
-rw-r--r--src/api/routes/channels/#channel_id/threads.ts8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/api/routes/channels/#channel_id/threads.ts b/src/api/routes/channels/#channel_id/threads.ts

index 8ef2c0fe8..261a3ccb7 100644 --- a/src/api/routes/channels/#channel_id/threads.ts +++ b/src/api/routes/channels/#channel_id/threads.ts
@@ -217,7 +217,8 @@ router.get( }, }), async (req: Request, res: Response) => { - const { name, slop, tag, tag_setting, archived, sort_by, sort_order, limit, offset, max_id, min_id } = req.query as Record<string, string>; + const { name, slop, tag, tag_setting, archived, sort_by, sort_order, limit, offset, max_id, min_id } = req.query as Record<string, string | undefined>; + const tags = tag ? tag.split(",") : []; const { channel_id } = req.params as Record<string, string>; const parsedLimit = Number(limit) || 25; @@ -260,6 +261,9 @@ router.get( where: { parent_id: channel_id, ...(name ? { name: Like(`%${name}%`) } : {}), + //If someone else knows something that's less hacky looking let me know + //@ts-expect-error this works, you're allowed to use an array here + applied_tags: tags as string, ...(archived ? { thread_metadata: { @@ -287,7 +291,7 @@ router.get( }, }); - const left = total_results - threads.length - +offset; + const left = total_results - threads.length - +(offset || 0); return res.json({ threads: threads.map((_) => _.toJSON()), members: (await members).map((_) => _.toJSON()),