+
{thread.visibility === "SEARCH_SPACE" ? (
) : (
-
+
)}
{t("more_options") || "More options"}
diff --git a/surfsense_web/contracts/types/folder.types.ts b/surfsense_web/contracts/types/folder.types.ts
index 8a9696a1f..0f7afd48b 100644
--- a/surfsense_web/contracts/types/folder.types.ts
+++ b/surfsense_web/contracts/types/folder.types.ts
@@ -1,6 +1,6 @@
import { z } from "zod";
-export const folder = z.object({
+const folderBase = z.object({
id: z.number(),
name: z.string(),
position: z.string(),
@@ -12,6 +12,16 @@ export const folder = z.object({
metadata: z.record(z.string(), z.any()).nullable().optional(),
});
+export const folder = z.preprocess((value) => {
+ if (typeof value === "object" && value !== null && !Array.isArray(value)) {
+ const record = value as Record;
+ if (record.search_space_id === undefined && record.workspace_id !== undefined) {
+ return { ...record, search_space_id: record.workspace_id };
+ }
+ }
+ return value;
+}, folderBase);
+
export const folderCreateRequest = z.object({
name: z.string().min(1).max(255),
parent_id: z.number().nullable().optional(),