Skip to content

Commit

Permalink
notifica gli organizzatori se viene modificato un seminario
Browse files Browse the repository at this point in the history
  • Loading branch information
paolini committed Sep 26, 2024
1 parent eb3926c commit c7111a6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dm-manager",
"version": "1.8.6",
"version": "1.8.7",
"private": true,
"dependencies": {
"@babel/core": "^7.16.0",
Expand Down
18 changes: 18 additions & 0 deletions server/controllers/processes/seminars.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,24 @@ require('./conferenceRoomSearch')(router)
require('./seminarCategorySearch')(router)

async function notifySeminar(seminar) {

// notify all organizers
if (seminar.organizers && seminar.organizers.length > 0) {
const organizers = await Person.find({ _id: { $in: seminar.organizers }})
for (const organizer of organizers) {
if (!organizer.email) continue
const text = `
È stato creato o modificato un seminario per il quale sei organizzatore.
Il titolo del seminario è ${seminar.title};
l'abstract è disponibile al link https://www.dm.unipi.it/en/seminar/?id=${seminar._id}.
`
await notify(organizer.email, `${seminar._id}`, text)
}
}

// notification for related visitor

// For matching visitors, we only care about the days, and ignore the actual time
// at which the seminar is scheduled.
const startDate = new Date(seminar.startDatetime); startDate.setHours(0)
Expand Down

0 comments on commit c7111a6

Please sign in to comment.