diff --git a/lib/applications.js b/lib/applications.js index b247be89..2d884467 100644 --- a/lib/applications.js +++ b/lib/applications.js @@ -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, @@ -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: { @@ -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; @@ -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: { diff --git a/test/assets/oms-core-body-members.json b/test/assets/oms-core-body-members.json index b6296073..ec296f3c 100644 --- a/test/assets/oms-core-body-members.json +++ b/test/assets/oms-core-body-members.json @@ -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, @@ -34,4 +34,4 @@ "body": null } ] -} \ No newline at end of file +} diff --git a/test/assets/oms-core-members.json b/test/assets/oms-core-members.json index 84ba70aa..24f5567d 100644 --- a/test/assets/oms-core-members.json +++ b/test/assets/oms-core-members.json @@ -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, @@ -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, @@ -33,4 +33,4 @@ "address": "Europe", "about_me": "random" }] -} \ No newline at end of file +} diff --git a/test/assets/oms-core-valid.json b/test/assets/oms-core-valid.json index 4b7b9293..9972fc75 100644 --- a/test/assets/oms-core-valid.json +++ b/test/assets/oms-core-valid.json @@ -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, @@ -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." } -} \ No newline at end of file +}