@@ -19,6 +19,7 @@ import { inject, injectable } from "inversify";
19
19
import { Authorizer } from "../authorization/authorizer" ;
20
20
import { ProjectsService } from "../projects/projects-service" ;
21
21
import { TransactionalContext } from "@gitpod/gitpod-db/lib/typeorm/transactional-db-impl" ;
22
+ import { Config } from "../config" ;
22
23
23
24
@injectable ( )
24
25
export class OrganizationService {
@@ -28,6 +29,7 @@ export class OrganizationService {
28
29
@inject ( ProjectsService ) private readonly projectsService : ProjectsService ,
29
30
@inject ( Authorizer ) private readonly auth : Authorizer ,
30
31
@inject ( IAnalyticsWriter ) private readonly analytics : IAnalyticsWriter ,
32
+ @inject ( Config ) protected readonly config : Config ,
31
33
) { }
32
34
33
35
async listOrganizations (
@@ -327,11 +329,18 @@ export class OrganizationService {
327
329
328
330
async getSettings ( userId : string , orgId : string ) : Promise < OrganizationSettings > {
329
331
await this . auth . checkPermissionOnOrganization ( userId , "read_settings" , orgId ) ;
330
- return ( await this . teamDB . findOrgSettings ( orgId ) ) || { } ;
332
+ const settings = ( await this . teamDB . findOrgSettings ( orgId ) ) || { } ;
333
+ if ( ! settings . defaultWorkspaceImage ) {
334
+ settings . defaultWorkspaceImage = this . config . workspaceDefaults . workspaceImage ;
335
+ }
336
+ return settings ;
331
337
}
332
338
333
339
async updateSettings ( userId : string , orgId : string , settings : OrganizationSettings ) : Promise < OrganizationSettings > {
334
340
await this . auth . checkPermissionOnOrganization ( userId , "write_settings" , orgId ) ;
341
+ if ( ! settings . defaultWorkspaceImage ) {
342
+ settings . defaultWorkspaceImage = this . config . workspaceDefaults . workspaceImage ;
343
+ }
335
344
await this . teamDB . setOrgSettings ( orgId , settings ) ;
336
345
return settings ;
337
346
}
0 commit comments