Skip to content

Commit 97ae60f

Browse files
committed
Allow empty image to set to default one
1 parent 5f0daea commit 97ae60f

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

components/gitpod-db/src/typeorm/entity/db-team-settings.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ export class DBOrgSettings implements OrganizationSettings {
1818
})
1919
workspaceSharingDisabled?: boolean;
2020

21-
@Column()
22-
defaultWorkspaceImage?: string; // TODO: migration
21+
@Column("varchar", { nullable: true })
22+
defaultWorkspaceImage?: string | null; // TODO: migration
2323

2424
@Column()
2525
deleted: boolean;

components/gitpod-db/src/typeorm/team-db-impl.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,10 @@ export class TeamDBImpl extends TransactionalDBImpl<TeamDB> implements TeamDB {
381381
if (settings.workspaceSharingDisabled != undefined) {
382382
update.workspaceSharingDisabled = settings.workspaceSharingDisabled;
383383
}
384-
if (settings.defaultWorkspaceImage) {
384+
// Set to null if defaultWorkspaceImage is empty string, so that we can fallback to default when getting org settings
385+
if (settings.defaultWorkspaceImage?.trim() === "") {
386+
update.defaultWorkspaceImage = null;
387+
} else if (settings.defaultWorkspaceImage != undefined) {
385388
update.defaultWorkspaceImage = settings.defaultWorkspaceImage;
386389
}
387390
if (!team) {

components/gitpod-protocol/go/gitpod-service.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2256,8 +2256,8 @@ type TeamMembershipInvite struct {
22562256
}
22572257

22582258
type OrganizationSettings struct {
2259-
WorkspaceSharingDisabled bool `json:"workspaceSharingDisabled,omitempty"`
2260-
DefaultWorkspaceImage string `json:"defaultWorkspaceImage,omitempty"`
2259+
WorkspaceSharingDisabled bool `json:"workspaceSharingDisabled,omitempty"`
2260+
DefaultWorkspaceImage *string `json:"defaultWorkspaceImage,omitempty"`
22612261
}
22622262

22632263
type Project struct {

components/gitpod-protocol/src/teams-projects-protocol.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ export interface Organization {
168168

169169
export interface OrganizationSettings {
170170
workspaceSharingDisabled?: boolean;
171-
defaultWorkspaceImage?: string;
171+
defaultWorkspaceImage?: string | null;
172172
}
173173

174174
export type TeamMemberRole = OrgMemberRole;

0 commit comments

Comments
 (0)