From 2091f1f72a0710443790630bf2a12ea993cf4215 Mon Sep 17 00:00:00 2001 From: Alex Tugarev Date: Tue, 5 Dec 2023 16:07:03 +0000 Subject: [PATCH] fixup fromWorkspaceAutostartOption --- .../typescript-common/src/public-api-converter.ts | 12 ++++++++---- components/server/src/user/user-service.ts | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/components/public-api/typescript-common/src/public-api-converter.ts b/components/public-api/typescript-common/src/public-api-converter.ts index e72185c95802d5..42adf0069452d9 100644 --- a/components/public-api/typescript-common/src/public-api-converter.ts +++ b/components/public-api/typescript-common/src/public-api-converter.ts @@ -4,6 +4,8 @@ * See License.AGPL.txt in the project root for license information. */ +import "reflect-metadata"; + import { Timestamp, toPlainMessage, PartialMessage, Duration } from "@bufbuild/protobuf"; import { Code, ConnectError } from "@connectrpc/connect"; import { @@ -135,6 +137,7 @@ import type { DeepPartial } from "@gitpod/gitpod-protocol/lib/util/deep-partial" import { BlockedRepository as ProtocolBlockedRepository } from "@gitpod/gitpod-protocol/lib/blocked-repositories-protocol"; import { RoleOrPermission } from "@gitpod/gitpod-protocol/lib/permission"; import { parseGoDurationToMs } from "@gitpod/gitpod-protocol/lib/util/timeutil"; +import { isWorkspaceRegion } from "@gitpod/gitpod-protocol/lib/workspace-cluster"; export type PartialConfiguration = DeepPartial & Pick; @@ -1228,7 +1231,7 @@ export class PublicAPIConverter { if (!e) { return undefined; } - return { + return { defaultIde: e.name, useLatestVersion: e.version === "latest", }; @@ -1245,11 +1248,12 @@ export class PublicAPIConverter { } fromWorkspaceAutostartOption(o: User_WorkspaceAutostartOption): WorkspaceAutostartOption { - return { + const region = isWorkspaceRegion(o.region) ? o.region : ""; + return { cloneURL: o.cloneUrl, - editorSettings: this.fromEditorReference(o.editorSettings), + ideSettings: this.fromEditorReference(o.editorSettings), organizationId: o.organizationId, - region: o.region, + region, workspaceClass: o.workspaceClass, }; } diff --git a/components/server/src/user/user-service.ts b/components/server/src/user/user-service.ts index c6e7dcfedb8ccb..282bf3eae74419 100644 --- a/components/server/src/user/user-service.ts +++ b/components/server/src/user/user-service.ts @@ -24,7 +24,7 @@ import { CreateUserParams } from "./user-authentication"; import { IAnalyticsWriter } from "@gitpod/gitpod-protocol/lib/analytics"; import { TransactionalContext } from "@gitpod/gitpod-db/lib/typeorm/transactional-db-impl"; import { RelationshipUpdater } from "../authorization/relationship-updater"; -import { getProfile } from "@gitpod/public-api-common/src/user-utils"; +import { getProfile } from "@gitpod/public-api-common/lib/user-utils"; @injectable() export class UserService {