fix: smpt email visibility (#32492)
This commit is contained in:
@@ -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},
|
||||
};
|
||||
|
||||
|
||||
@@ -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": {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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' }));
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user