Skip to content

Commit

Permalink
fix(mail): update to field mailer (#438)
Browse files Browse the repository at this point in the history
Co-authored-by: Rik Smale <wikirik000@gmail.com>
Co-authored-by: Rik Smale <WikiRik@users.noreply.github.com>
  • Loading branch information
3 people committed Feb 8, 2021
1 parent 1d02848 commit b562efe
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions lib/applications.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ exports.updateApplication = async (req, res) => {
req.body.first_name = user.first_name;
req.body.last_name = user.last_name;
req.body.gender = user.gender;
req.body.email = user.email;
req.body.email = user.notification_email;
req.body.date_of_birth = user.date_of_birth;
if (req.body.body_id) {
// Shouldn't crash, if the person is not a member of a body,
Expand Down Expand Up @@ -296,7 +296,7 @@ exports.updateApplication = async (req, res) => {

if (boardMembers.length > 0) {
await mailer.sendMail({
to: boardMembers.map((member) => member.user.email),
to: boardMembers.map((member) => member.user.notification_email),
subject: `One of your body members changed the application to ${req.event.name}`,
template: 'statutory_board_edited.html',
parameters: {
Expand Down Expand Up @@ -612,7 +612,7 @@ exports.postApplication = async (req, res) => {
req.body.first_name = req.user.first_name;
req.body.last_name = req.user.last_name;
req.body.gender = req.user.gender;
req.body.email = req.user.email;
req.body.email = req.user.notification_email;
req.body.body_name = req.user.bodies.find((b) => req.body.body_id === b.id).name;
req.body.date_of_birth = req.user.date_of_birth;

Expand Down Expand Up @@ -643,7 +643,7 @@ exports.postApplication = async (req, res) => {

if (boardMembers.length > 0) {
await mailer.sendMail({
to: boardMembers.map((member) => member.user.email),
to: boardMembers.map((member) => member.user.notification_email),
subject: `One of your body members has applied to ${req.event.name}`,
template: 'statutory_board_applied.html',
parameters: {
Expand Down
4 changes: 2 additions & 2 deletions test/assets/oms-core-body-members.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"name": "paul.smits",
"inserted_at": "2018-05-04T11:16:50.531076",
"id": 9,
"email": "paul.l.smits@gmail.com",
"notification_email": "paul.l.smits@gmail.com",
"active": true,
"seo_url": "36125407_",
"primary_body_id": null,
Expand All @@ -34,4 +34,4 @@
"body": null
}
]
}
}
6 changes: 3 additions & 3 deletions test/assets/oms-core-members.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"superadmin": true,
"name": "admin",
"inserted_at": "2018-05-03T23:12:01.111566",
"email": "admin@aegee.org",
"notification_email": "admin@aegee.org",
"active": true,
"primary_body_id": null,
"primary_body": null,
Expand All @@ -20,7 +20,7 @@
"superadmin": false,
"name": "not_admin",
"inserted_at": "2018-05-03T23:12:01.111566",
"email": "test@aegee.org",
"notification_email": "test@aegee.org",
"active": true,
"primary_body_id": null,
"primary_body": null,
Expand All @@ -33,4 +33,4 @@
"address": "Europe",
"about_me": "random"
}]
}
}
4 changes: 2 additions & 2 deletions test/assets/oms-core-valid.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"superadmin": true,
"name": "admin",
"inserted_at": "2018-05-03T23:12:01.111566",
"email": "admin@aegee.org",
"notification_email": "admin@aegee.org",
"active": true,
"primary_body_id": null,
"primary_body": null,
Expand Down Expand Up @@ -253,4 +253,4 @@
"address": "Europe",
"about_me": "I am a microservice. I have a user account so the system can access itself from within, don't delete me."
}
}
}

0 comments on commit b562efe

Please sign in to comment.