fix(console): exclude migrated workspaces from selection (#49336)

This commit is contained in:
Victor Navarro 2026-09-16 15:07:22 +02:00 committed by GitHub
parent e03db9bc69
commit 501ff62cbf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 0 deletions

View file

@ -1,4 +1,5 @@
import { redirect } from "@solidjs/router"
import { Resource } from "@opencode-ai/console-resource"
import type { APIEvent } from "@solidjs/start/server"
import { getLastSeenWorkspaceID } from "../workspace/common"
import { localeFromRequest, route } from "~/lib/language"
@ -7,6 +8,11 @@ export async function GET(input: APIEvent) {
const locale = localeFromRequest(input.request)
try {
const workspaceID = await getLastSeenWorkspaceID()
if (!workspaceID) {
const destination = Resource.ConsoleMigration.consoleUrl
if (!destination) throw new Error("New Console URL is not configured")
return redirect(`${destination}/login`, { headers: { "Cache-Control": "no-store" } })
}
return redirect(route(locale, `/workspace/${workspaceID}`))
} catch {
return redirect("/auth/authorize")

View file

@ -27,6 +27,7 @@ const getWorkspaces = query(async () => {
and(
eq(UserTable.accountID, Actor.account()),
isNull(WorkspaceTable.timeDeleted),
isNull(WorkspaceTable.migrated_at),
isNull(UserTable.timeDeleted),
),
),

View file

@ -53,6 +53,7 @@ export async function getLastSeenWorkspaceID() {
eq(UserTable.accountID, actor.properties.accountID),
isNull(UserTable.timeDeleted),
isNull(WorkspaceTable.timeDeleted),
isNull(WorkspaceTable.migrated_at),
),
)
.orderBy(desc(UserTable.timeSeen))