From 5c452a7512f41036fa3005c17e794e0b6bd12b6a Mon Sep 17 00:00:00 2001 From: twotalesanimation <80506065+twotalesanimation@users.noreply.github.com> Date: Sun, 24 May 2026 18:15:06 +0200 Subject: [PATCH] kanban share with client enabled --- actions/tasks.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/actions/tasks.ts b/actions/tasks.ts index c2f22a0..1685dcf 100644 --- a/actions/tasks.ts +++ b/actions/tasks.ts @@ -267,6 +267,26 @@ export async function updateTaskStatus(taskId: string, status: TaskStatus) { }).catch(() => {}); } + // When moved to CLIENT_REVIEW, mark the latest version as client-visible + // (same effect as clicking "Share with Client" on the video player page) + if (status === "CLIENT_REVIEW") { + const latestVersion = await db.version.findFirst({ + where: { taskId, isLatest: true }, + select: { id: true, isClientVisible: true }, + }); + if (latestVersion && !latestVersion.isClientVisible) { + await db.version.update({ + where: { id: latestVersion.id }, + data: { + isClientVisible: true, + sharedAt: new Date(), + sharedById: session.user.id, + }, + }); + revalidatePath(`/review/${latestVersion.id}`); + } + } + // Recalculate shot status from task states if (task.shot) { await recalcShotStatus(task.shot.id).catch(() => {});