fix: smpt email visibility (#32492)

This commit is contained in:
Jason Rasmussen
2026-10-17 19:32:36 +03:00
committed by Codex
parent 424c26c697
commit 4341a2f34c
5 changed files with 43 additions and 1 deletions
+1
View File
@@ -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},
};
+27
View File
@@ -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": {
+8
View File
@@ -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;
+6
View File
@@ -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' }));
+1 -1
View File
@@ -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