fix(console): exclude migrated workspaces from selection (#49336)
This commit is contained in:
parent
e03db9bc69
commit
501ff62cbf
3 changed files with 8 additions and 0 deletions
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ const getWorkspaces = query(async () => {
|
|||
and(
|
||||
eq(UserTable.accountID, Actor.account()),
|
||||
isNull(WorkspaceTable.timeDeleted),
|
||||
isNull(WorkspaceTable.migrated_at),
|
||||
isNull(UserTable.timeDeleted),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Reference in a new issue