summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMathMan05 <mathmanrm@gmail.com>2026-02-05 11:48:51 -0600
committerMathMan05 <mathmanrm@gmail.com>2026-02-05 11:48:51 -0600
commit6f700e85cf1ffcbfccf9dfddad3612301c2bf7e8 (patch)
tree66352aac79a2d91d9c05e69f741d291790857551 /src
parentedit tags (diff)
downloadserver-ts-6f700e85cf1ffcbfccf9dfddad3612301c2bf7e8.tar.xz
better search
Diffstat (limited to 'src')
-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 8ef2c0fe..261a3ccb 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()),