feat(PBI-76): rewrite setActiveSprint callers to use settings
setActiveSprintAction, syncActiveSprintCookieAction, and the two sprint-creation paths in actions/sprints.ts now write through setActiveSprintInSettings (which also emits pg_notify for cross-tab sync) instead of dropping a cookie. The action names keep the 'cookie' suffix in the user-visible API for now — clean rename can come later. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
0e3893dbab
commit
6212a3232c
2 changed files with 6 additions and 6 deletions
|
|
@ -7,7 +7,7 @@ import { z } from 'zod'
|
|||
import { prisma } from '@/lib/prisma'
|
||||
import { SessionData, sessionOptions } from '@/lib/session'
|
||||
import { productAccessFilter } from '@/lib/product-access'
|
||||
import { setActiveSprintCookie } from '@/lib/active-sprint'
|
||||
import { setActiveSprintInSettings } from '@/lib/active-sprint'
|
||||
|
||||
async function getSession() {
|
||||
return getIronSession<SessionData>(await cookies(), sessionOptions)
|
||||
|
|
@ -36,7 +36,7 @@ export async function setActiveSprintAction(productId: string, sprintId: string)
|
|||
})
|
||||
if (!sprint) return { error: 'Sprint niet gevonden of niet toegankelijk' }
|
||||
|
||||
await setActiveSprintCookie(parsed.data.productId, parsed.data.sprintId)
|
||||
await setActiveSprintInSettings(session.userId, parsed.data.productId, parsed.data.sprintId)
|
||||
revalidatePath('/', 'layout')
|
||||
return { success: true, sprintId: parsed.data.sprintId }
|
||||
}
|
||||
|
|
@ -59,5 +59,5 @@ export async function syncActiveSprintCookieAction(productId: string, sprintId:
|
|||
})
|
||||
if (!sprint) return
|
||||
|
||||
await setActiveSprintCookie(parsed.data.productId, parsed.data.sprintId)
|
||||
await setActiveSprintInSettings(session.userId, parsed.data.productId, parsed.data.sprintId)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import {
|
|||
import { enforceUserRateLimit } from '@/lib/rate-limit'
|
||||
import { propagateStatusUpwards } from '@/lib/tasks-status-update'
|
||||
import { createWithCodeRetry, generateNextSprintCode } from '@/lib/code-server'
|
||||
import { setActiveSprintCookie } from '@/lib/active-sprint'
|
||||
import { setActiveSprintInSettings } from '@/lib/active-sprint'
|
||||
import { z } from 'zod'
|
||||
|
||||
async function getSession() {
|
||||
|
|
@ -102,7 +102,7 @@ export async function createSprintAction(_prevState: unknown, formData: FormData
|
|||
}
|
||||
}
|
||||
|
||||
await setActiveSprintCookie(parsed.data.productId, sprint.id)
|
||||
await setActiveSprintInSettings(session.userId, parsed.data.productId, sprint.id)
|
||||
revalidatePath(`/products/${parsed.data.productId}`, 'layout')
|
||||
return { success: true, sprintId: sprint.id }
|
||||
}
|
||||
|
|
@ -409,7 +409,7 @@ export async function createSprintWithPbisAction(input: {
|
|||
}),
|
||||
)
|
||||
|
||||
await setActiveSprintCookie(parsed.data.productId, sprint.id)
|
||||
await setActiveSprintInSettings(session.userId, parsed.data.productId, sprint.id)
|
||||
revalidatePath(`/products/${parsed.data.productId}`, 'layout')
|
||||
return { success: true, sprintId: sprint.id }
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue