Skip to content

Commit

Permalink
BC-8681 - replace nbc mail addresses (#5438)
Browse files Browse the repository at this point in the history
* provide dof configured SC_CONTACT_MAIL to nuxt-client
  • Loading branch information
hoeppner-dataport authored and HKayed committed Jan 30, 2025
1 parent 69ab7d6 commit 8718e92
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
4 changes: 4 additions & 0 deletions apps/server/src/modules/server/api/dto/config.response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ export class ConfigResponse {
@ApiProperty()
ACCESSIBILITY_REPORT_EMAIL: string;

@ApiProperty()
SC_CONTACT_EMAIL: string;

@ApiProperty()
FEATURE_NEW_SCHOOL_ADMINISTRATION_PAGE_AS_DEFAULT_ENABLED: boolean;

Expand Down Expand Up @@ -232,6 +235,7 @@ export class ConfigResponse {

constructor(config: ServerConfig) {
this.ACCESSIBILITY_REPORT_EMAIL = config.ACCESSIBILITY_REPORT_EMAIL;
this.SC_CONTACT_EMAIL = config.SC_CONTACT_EMAIL;
this.ADMIN_TABLES_DISPLAY_CONSENT_COLUMN = config.ADMIN_TABLES_DISPLAY_CONSENT_COLUMN;
this.ALERT_STATUS_URL = config.ALERT_STATUS_URL;
this.CALENDAR_SERVICE_ENABLED = config.CALENDAR_SERVICE_ENABLED;
Expand Down
1 change: 1 addition & 0 deletions apps/server/src/modules/server/api/test/server.api.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ describe('Server Controller (API)', () => {
'ROCKETCHAT_SERVICE_ENABLED',
'SC_THEME',
'SC_TITLE',
'SC_CONTACT_EMAIL',
'TRAINING_URL',
'TEACHER_STUDENT_VISIBILITY__IS_CONFIGURABLE',
'TEACHER_STUDENT_VISIBILITY__IS_ENABLED_BY_DEFAULT',
Expand Down
2 changes: 2 additions & 0 deletions apps/server/src/modules/server/server.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export interface ServerConfig
SC_DOMAIN: string;
HOST: string;
ACCESSIBILITY_REPORT_EMAIL: string;
SC_CONTACT_EMAIL: string;
ADMIN_TABLES_DISPLAY_CONSENT_COLUMN: boolean;
ALERT_STATUS_URL: string | null;
CALENDAR_SERVICE_ENABLED: boolean;
Expand Down Expand Up @@ -131,6 +132,7 @@ export interface ServerConfig

const config: ServerConfig = {
ACCESSIBILITY_REPORT_EMAIL: Configuration.get('ACCESSIBILITY_REPORT_EMAIL') as string,
SC_CONTACT_EMAIL: Configuration.get('SC_CONTACT_EMAIL') as string,
ADMIN_TABLES_DISPLAY_CONSENT_COLUMN: Configuration.get('ADMIN_TABLES_DISPLAY_CONSENT_COLUMN') as boolean,
ALERT_STATUS_URL:
Configuration.get('ALERT_STATUS_URL') === null
Expand Down
5 changes: 5 additions & 0 deletions config/default.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1184,6 +1184,11 @@
"default": "/login",
"description": "Determines the url to be redirected to when the user is not authenticated"
},
"SC_CONTACT_EMAIL": {
"type": "string",
"default": "[email protected]",
"description": "Email address used for contacting"
},
"ACCESSIBILITY_REPORT_EMAIL": {
"type": "string",
"default": "[email protected]",
Expand Down
11 changes: 7 additions & 4 deletions test/services/helpdesk/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ describe('helpdesk service', function test() {
const mailService = new MockMailService();
app.use('/mails', mailService);
const tempScTheme = Configuration.get('SUPPORT_PROBLEM_EMAIL_ADDRESS');
Configuration.set('SUPPORT_PROBLEM_EMAIL_ADDRESS', '[email protected]');
Configuration.set('SUPPORT_PROBLEM_EMAIL_ADDRESS', '[email protected]');
await helpdeskService.create(postBody, { account: { userId: '0000d213816abba584714c0a' } });
expect(mailService.create.firstArg.email).to.equal('[email protected]');
expect(mailService.create.firstArg.email).to.equal('[email protected]');
Configuration.set('SUPPORT_PROBLEM_EMAIL_ADDRESS', tempScTheme);
});

Expand Down Expand Up @@ -169,10 +169,13 @@ describe('helpdesk service', function test() {
const mailService = new MockMailService();
app.use('/mails', mailService);
const tempScTheme = Configuration.get('SUPPORT_WISH_EMAIL_ADDRESS');
Configuration.set('SUPPORT_WISH_EMAIL_ADDRESS', '[email protected],[email protected]');
Configuration.set(
'SUPPORT_WISH_EMAIL_ADDRESS',
'[email protected],[email protected]'
);
await helpdeskService.create(postBody, { account: { userId: '0000d213816abba584714c0a' } });
expect(mailService.create.args.length).to.equal(2);
expect(mailService.create.args[0][0].email).to.equal('[email protected]');
expect(mailService.create.args[0][0].email).to.equal('[email protected]');
expect(mailService.create.args[1][0].email).to.equal('[email protected]');
Configuration.set('SUPPORT_WISH_EMAIL_ADDRESS', tempScTheme);
});
Expand Down

0 comments on commit 8718e92

Please sign in to comment.