mirror of
https://github.com/RuoJi6/ARTEX.git
synced 2026-11-25 10:11:50 +08:00
feat: make task global asset sharing opt-in
This commit is contained in:
1 parent
d36e1c3295
commit
080a46eb2d
25 files changed
+838
-328
No files matched your search
@@ -253,6 +253,7 @@ function mockTaskArchiveBlocker(taskID: string): string | undefined {
|
||||
|
||||
function publicMockTask(task: Task): Task {
|
||||
const item = structuredClone(task);
|
||||
item.share_global_assets = task.share_global_assets ?? false;
|
||||
const blocker = mockTaskArchiveBlocker(task.id);
|
||||
if (blocker) item.archive_blocked_by_task_id = blocker;
|
||||
else delete item.archive_blocked_by_task_id;
|
||||
@@ -1272,6 +1273,7 @@ function route(m: string, path: string, seg: string[], q: URLSearchParams, b: Re
|
||||
llm_failover_state: profileIDs.length ? "ready" : "default",
|
||||
source_task_ids: sourceTaskIDs,
|
||||
company_ids: companyIDs,
|
||||
share_global_assets: b.share_global_assets === true,
|
||||
};
|
||||
const numericTaskID = nextMockTaskAssetID++;
|
||||
mockTaskAssetIDs.set(id, numericTaskID);
|
||||
@@ -1460,10 +1462,12 @@ function route(m: string, path: string, seg: string[], q: URLSearchParams, b: Re
|
||||
if (has("name") && b.name !== null && typeof b.name !== "string") throw new Error("任务名称必须是字符串");
|
||||
if (has("remark") && b.remark !== null && typeof b.remark !== "string") throw new Error("备注必须是字符串");
|
||||
if (has("pinned") && b.pinned !== null && typeof b.pinned !== "boolean") throw new Error("pinned 必须是布尔值");
|
||||
if (has("share_global_assets") && b.share_global_assets !== null && typeof b.share_global_assets !== "boolean") throw new Error("share_global_assets 必须是布尔值");
|
||||
const sharingPresent = has("share_global_assets") && b.share_global_assets !== null;
|
||||
const namePresent = has("name") && b.name !== null;
|
||||
const remarkPresent = has("remark") && b.remark !== null;
|
||||
const pinnedPresent = has("pinned") && b.pinned !== null;
|
||||
if (!namePresent && !remarkPresent && !pinnedPresent) throw new Error("至少需要提供 name、pinned 或 remark");
|
||||
if (!namePresent && !remarkPresent && !pinnedPresent && !sharingPresent) throw new Error("至少需要提供 name、pinned、remark 或 share_global_assets");
|
||||
let nextName = task.name;
|
||||
let nextRemark = task.remark;
|
||||
let nextPinned = task.pinned;
|
||||
@@ -1480,6 +1484,7 @@ function route(m: string, path: string, seg: string[], q: URLSearchParams, b: Re
|
||||
nextPinned = pinned;
|
||||
nextPinnedAt = pinned ? (task.pinned_at ?? new Date().toISOString()) : null;
|
||||
}
|
||||
if (sharingPresent) task.share_global_assets = b.share_global_assets as boolean;
|
||||
task.name = nextName;
|
||||
task.remark = nextRemark;
|
||||
task.pinned = nextPinned;
|
||||
|
||||
Reference in new issue
Block a user