Skip to content

Commit

Permalink
Allow empty image to set to default one
Browse files Browse the repository at this point in the history
  • Loading branch information
mustard-mh committed Sep 18, 2023
1 parent 5f0daea commit 97ae60f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions components/gitpod-db/src/typeorm/entity/db-team-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export class DBOrgSettings implements OrganizationSettings {
})
workspaceSharingDisabled?: boolean;

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

@Column()
deleted: boolean;
Expand Down
5 changes: 4 additions & 1 deletion components/gitpod-db/src/typeorm/team-db-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,10 @@ export class TeamDBImpl extends TransactionalDBImpl<TeamDB> implements TeamDB {
if (settings.workspaceSharingDisabled != undefined) {
update.workspaceSharingDisabled = settings.workspaceSharingDisabled;
}
if (settings.defaultWorkspaceImage) {
// Set to null if defaultWorkspaceImage is empty string, so that we can fallback to default when getting org settings
if (settings.defaultWorkspaceImage?.trim() === "") {
update.defaultWorkspaceImage = null;
} else if (settings.defaultWorkspaceImage != undefined) {
update.defaultWorkspaceImage = settings.defaultWorkspaceImage;
}
if (!team) {
Expand Down
4 changes: 2 additions & 2 deletions components/gitpod-protocol/go/gitpod-service.go
Original file line number Diff line number Diff line change
Expand Up @@ -2256,8 +2256,8 @@ type TeamMembershipInvite struct {
}

type OrganizationSettings struct {
WorkspaceSharingDisabled bool `json:"workspaceSharingDisabled,omitempty"`
DefaultWorkspaceImage string `json:"defaultWorkspaceImage,omitempty"`
WorkspaceSharingDisabled bool `json:"workspaceSharingDisabled,omitempty"`
DefaultWorkspaceImage *string `json:"defaultWorkspaceImage,omitempty"`
}

type Project struct {
Expand Down
2 changes: 1 addition & 1 deletion components/gitpod-protocol/src/teams-projects-protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export interface Organization {

export interface OrganizationSettings {
workspaceSharingDisabled?: boolean;
defaultWorkspaceImage?: string;
defaultWorkspaceImage?: string | null;
}

export type TeamMemberRole = OrgMemberRole;
Expand Down

0 comments on commit 97ae60f

Please sign in to comment.