summaryrefslogtreecommitdiff
path: root/routes.js
diff options
context:
space:
mode:
authorRaphael Kabo <raphaelkabo@gmail.com>2022-01-17 11:19:22 +0000
committerRaphael Kabo <raphaelkabo@gmail.com>2022-01-17 11:19:22 +0000
commit4ef3273f8bca7ad84140730cea9e7842ee5a0a79 (patch)
tree6821e50a901589a7533a97e2211c4378d3780734 /routes.js
parent1873af016e95bf2df512e332c7014e233cd57c17 (diff)
Make emails optional when creating events/groups
Diffstat (limited to 'routes.js')
-rwxr-xr-xroutes.js10
1 files changed, 4 insertions, 6 deletions
diff --git a/routes.js b/routes.js
index 115e8cd..9ec2b2a 100755
--- a/routes.js
+++ b/routes.js
@@ -691,7 +691,7 @@ router.post('/newevent', async (req, res) => {
.then((event) => {
addToLog("createEvent", "success", "Event " + eventID + "created");
// Send email with edit link
- if (sendEmails) {
+ if (req.body.creatorEmail && sendEmails) {
req.app.get('hbsInstance').renderView('./views/emails/createevent.handlebars', { eventID, editToken, siteName, siteLogo, domain, cache: true, layout: 'email.handlebars' }, function (err, html) {
const msg = {
to: req.body.creatorEmail,
@@ -736,11 +736,9 @@ router.post('/importevent', (req, res) => {
let creatorEmail;
if (req.body.creatorEmail) {
- creatorEmail = req.body.creatorEmail
+ creatorEmail = req.body.creatorEmail;
} else if (importedEventData.organizer) {
creatorEmail = importedEventData.organizer.val.replace("MAILTO:", "");
- } else {
- res.status(500).send("Please supply an email address on the previous page.");
}
const event = new Event({
@@ -768,7 +766,7 @@ router.post('/importevent', (req, res) => {
.then(() => {
addToLog("createEvent", "success", "Event " + eventID + " created");
// Send email with edit link
- if (sendEmails) {
+ if (creatorEmail && sendEmails) {
req.app.get('hbsInstance').renderView('./views/emails/createevent.handlebars', { eventID, editToken, siteName, siteLogo, domain, cache: true, layout: 'email.handlebars' }, function (err, html) {
const msg = {
to: req.body.creatorEmail,
@@ -839,7 +837,7 @@ router.post('/neweventgroup', (req, res) => {
.then(() => {
addToLog("createEventGroup", "success", "Event group " + eventGroupID + " created");
// Send email with edit link
- if (sendEmails) {
+ if (req.body.creatorEmail && sendEmails) {
req.app.get('hbsInstance').renderView('./views/emails/createeventgroup.handlebars', { eventGroupID, editToken, siteName, siteLogo, domain, cache: true, layout: 'email.handlebars' }, function (err, html) {
const msg = {
to: req.body.creatorEmail,