Skip to content

Commit

Permalink
Update org settings fields
Browse files Browse the repository at this point in the history
  • Loading branch information
mustard-mh committed Sep 18, 2023
1 parent c2df290 commit 4987594
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions components/gitpod-db/src/typeorm/team-db-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,19 +377,23 @@ export class TeamDBImpl extends TransactionalDBImpl<TeamDB> implements TeamDB {
public async setOrgSettings(orgId: string, settings: Partial<OrganizationSettings>): Promise<void> {
const repo = await this.getOrgSettingsRepo();
const team = await repo.findOne({ where: { orgId, deleted: false } });
const update: Partial<OrganizationSettings> = {};
if (settings.workspaceSharingDisabled != undefined) {
update.workspaceSharingDisabled = settings.workspaceSharingDisabled;
}
if (settings.defaultWorkspaceImage) {
update.defaultWorkspaceImage = settings.defaultWorkspaceImage;
}
if (!team) {
await repo.insert({
...settings,
...update,
orgId,
});
} else {
if (settings.workspaceSharingDisabled) {
team.workspaceSharingDisabled = settings.workspaceSharingDisabled;
}
if (settings.defaultWorkspaceImage) {
team.defaultWorkspaceImage = settings.defaultWorkspaceImage;
}
repo.save(team);
repo.save({
...team,
...update,
});
}
}

Expand Down

0 comments on commit 4987594

Please sign in to comment.