Skip to content

Commit

Permalink
Merge pull request #750 from HDRUK/story/GAT-1086
Browse files Browse the repository at this point in the history
GAT-1086
  • Loading branch information
dnhdruk authored May 17, 2022
2 parents 238b3e1 + 211d344 commit cbe8beb
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 cbe8beb

Please sign in to comment.