Skip to content

High performance self-hosted photo and video management solution.

fix: smpt email visibility (#32492)

Jason Rasmussen0947c9ae8a37
diff --git a/mobile/lib/utils/openapi_patching.dart b/mobile/lib/utils/openapi_patching.dart
index 410f3f8d5f..ad073e937f 100644
--- a/mobile/lib/utils/openapi_patching.dart
+++ b/mobile/lib/utils/openapi_patching.dart
@@ -45,6 +45,7 @@ final Map<String, Map<String, Object?>> 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 ff7afe6e32..47e958dab3 100644
--- a/open-api/immich-openapi-specs.json
+++ b/open-api/immich-openapi-specs.json
@@ -33084,6 +33084,9 @@
"map": {
"$ref": "#/components/schemas/UserConfigMapDto"
},
+ "notifications": {
+ "$ref": "#/components/schemas/UserConfigNotificationsDto"
+ },
"oauth": {
"$ref": "#/components/schemas/UserConfigOAuthDto"
},
@@ -33111,6 +33114,7 @@
"image",
"machineLearning",
"map",
+ "notifications",
"oauth",
"passwordLogin",
"reverseGeocoding",
@@ -33288,6 +33292,17 @@
],
"type": "object"
},
+ "UserConfigNotificationsDto": {
+ "properties": {
+ "smtp": {
+ "$ref": "#/components/schemas/UserConfigSmtpDto"
+ }
+ },
+ "required": [
+ "smtp"
+ ],
+ "type": "object"
+ },
"UserConfigOAuthDto": {
"properties": {
"autoLaunch": {
@@ -33368,6 +33383,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 b44df9ba51..1429d9e751 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 931f100260..de5355c5d0 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<string, any>;
+
+ 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 feaa271080..2fa34bca67 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