Skip to content

Commit

Permalink
Merge pull request #751 from HDRUK/dev
Browse files Browse the repository at this point in the history
dev to release for GAT-1086
  • Loading branch information
dnhdruk authored May 17, 2022
2 parents 5ec0a21 + cbe8beb commit 3c5b9b5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/resources/dataUseRegister/dataUseRegister.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,13 +371,20 @@ export default class DataUseRegisterController extends Controller {

switch (type) {
case constants.dataUseRegisterNotifications.DATAUSEAPPROVED: {
let teamEmailNotification = [];
const adminTeam = await TeamModel.findOne({ type: 'admin' })
.populate({
path: 'users',
})
.lean();
const team = await TeamModel.findById(dataUseRegister.publisher.toString());
if (team.notifications.length > 0 && team.notifications[0].optIn) {
team.notifications[0].subscribedEmails.map(teamEmail => {
teamEmailNotification.push({email: teamEmail});
});
}
const dataUseTeamMembers = teamController.getTeamMembersByRole(adminTeam, constants.roleTypes.ADMIN_DATA_USE);
const emailRecipients = [...dataUseTeamMembers, uploader];
const emailRecipients = [...dataUseTeamMembers, uploader, ...teamEmailNotification];

const options = {
id,
Expand Down

0 comments on commit 3c5b9b5

Please sign in to comment.