From 3e9fcf7dba7490f2c193de212e155bcd9486db76 Mon Sep 17 00:00:00 2001 From: MathMan05 Date: Thu, 5 Feb 2026 11:55:59 -0600 Subject: [PATCH] implement tag_setting --- src/api/routes/channels/#channel_id/threads.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/api/routes/channels/#channel_id/threads.ts b/src/api/routes/channels/#channel_id/threads.ts index 261a3ccb7..26d49a686 100644 --- a/src/api/routes/channels/#channel_id/threads.ts +++ b/src/api/routes/channels/#channel_id/threads.ts @@ -38,7 +38,7 @@ import { ChannelType, MessageType, ThreadCreationSchema, MessageCreateAttachment import { Request, Response, Router } from "express"; import { messageUpload } from "./messages"; import { HTTPError } from "#util/util/lambert-server"; -import { FindManyOptions, FindOptionsOrder, In, Like } from "typeorm"; +import { FindManyOptions, FindOptionsOrder, In, Like, ArrayContains, ArrayOverlap } from "typeorm"; const router = Router({ mergeParams: true }); @@ -261,9 +261,8 @@ 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, + ...(tags.length ? { applied_tags: tag_setting === "match_all" ? ArrayContains(tags) : ArrayOverlap(tags) } : {}), + ...(archived ? { thread_metadata: {