From 4341a2f34c2a17852f675884cd6ed6dc4254e189 Mon Sep 17 00:00:00 2001 From: Jason Rasmussen Date: Fri, 16 Oct 2026 15:08:06 -0400 Subject: [PATCH] fix: smpt email visibility (#32492) --- mobile/lib/utils/openapi_patching.dart | 1 + open-api/immich-openapi-specs.json | 27 ++++++++++++++++++++++++++ packages/sdk/src/fetch-client.ts | 8 ++++++++ server/src/dtos/config.dto.spec.ts | 6 ++++++ server/src/dtos/config.dto.ts | 2 +- 5 files changed, 43 insertions(+), 1 deletion(-) diff --git a/mobile/lib/utils/openapi_patching.dart b/mobile/lib/utils/openapi_patching.dart index 410f3f8d5..ad073e937 100644 --- a/mobile/lib/utils/openapi_patching.dart +++ b/mobile/lib/utils/openapi_patching.dart @@ -45,6 +45,7 @@ final Map> openApiPatches = { 'PeopleResponse': {'updateStrategy': 'everyone'}, 'PersonResponseDto': {'otherPeople': const [], 'sharedBy': const [], 'sharedWith': const []}, 'ServerVersionResponseDto': {'featureLevel': 0}, + 'UserConfigDto': {'notifications': UserConfigNotificationsDto(smtp: UserConfigSmtpDto(enabled: false)).toJson()}, 'WorkflowResponseDto': {'logging': false}, }; diff --git a/open-api/immich-openapi-specs.json b/open-api/immich-openapi-specs.json index ba22549e4..8a7fb56c5 100644 --- a/open-api/immich-openapi-specs.json +++ b/open-api/immich-openapi-specs.json @@ -33113,6 +33113,9 @@ "map": { "$ref": "#/components/schemas/UserConfigMapDto" }, + "notifications": { + "$ref": "#/components/schemas/UserConfigNotificationsDto" + }, "oauth": { "$ref": "#/components/schemas/UserConfigOAuthDto" }, @@ -33140,6 +33143,7 @@ "image", "machineLearning", "map", + "notifications", "oauth", "passwordLogin", "reverseGeocoding", @@ -33317,6 +33321,17 @@ ], "type": "object" }, + "UserConfigNotificationsDto": { + "properties": { + "smtp": { + "$ref": "#/components/schemas/UserConfigSmtpDto" + } + }, + "required": [ + "smtp" + ], + "type": "object" + }, "UserConfigOAuthDto": { "properties": { "autoLaunch": { @@ -33397,6 +33412,18 @@ ], "type": "object" }, + "UserConfigSmtpDto": { + "properties": { + "enabled": { + "description": "Whether SMTP email notifications are enabled", + "type": "boolean" + } + }, + "required": [ + "enabled" + ], + "type": "object" + }, "UserConfigThemeDto": { "properties": { "customCss": { diff --git a/packages/sdk/src/fetch-client.ts b/packages/sdk/src/fetch-client.ts index a4d931515..623963433 100644 --- a/packages/sdk/src/fetch-client.ts +++ b/packages/sdk/src/fetch-client.ts @@ -1599,6 +1599,13 @@ export type UserConfigMapDto = { /** Light map style URL */ lightStyle: string; }; +export type UserConfigSmtpDto = { + /** Whether SMTP email notifications are enabled */ + enabled: boolean; +}; +export type UserConfigNotificationsDto = { + smtp: UserConfigSmtpDto; +}; export type UserConfigOAuthDto = { /** Auto launch */ autoLaunch: boolean; @@ -1642,6 +1649,7 @@ export type UserConfigDto = { image: UserConfigImageDto; machineLearning: UserConfigMachineLearningDto; map: UserConfigMapDto; + notifications: UserConfigNotificationsDto; oauth: UserConfigOAuthDto; passwordLogin: UserConfigPasswordLoginDto; reverseGeocoding: UserConfigReverseGeocodingDto; diff --git a/server/src/dtos/config.dto.spec.ts b/server/src/dtos/config.dto.spec.ts index 931f10026..de5355c5d 100644 --- a/server/src/dtos/config.dto.spec.ts +++ b/server/src/dtos/config.dto.spec.ts @@ -59,6 +59,12 @@ describe('config visibility', () => { expect(config.notifications).toBeUndefined(); }); + it('should expose only whether smtp is enabled to users', () => { + const config = mapUserConfig(defaults) as Record; + + expect(config.notifications).toEqual({ smtp: { enabled: defaults.notifications.smtp.enabled } }); + }); + it('should keep the visibility metadata out of the schemas', () => { for (const schema of [AdminConfigDto.schema, UserConfigDto.schema, PublicConfigDto.schema]) { const json = JSON.stringify(z.toJSONSchema(schema, { io: 'input', unrepresentable: 'any' })); diff --git a/server/src/dtos/config.dto.ts b/server/src/dtos/config.dto.ts index feaa27108..2fa34bca6 100644 --- a/server/src/dtos/config.dto.ts +++ b/server/src/dtos/config.dto.ts @@ -131,7 +131,7 @@ const AdminConfigFFmpegSchema = z const AdminConfigSmtpSchema = z .object({ - enabled: configBool.describe('Whether SMTP email notifications are enabled'), + enabled: configBool.describe('Whether SMTP email notifications are enabled').meta({ visibility: User }), from: z.string().describe('Email address to send from'), replyTo: z.string().describe('Email address for replies'), transport: z