Skip to content
This repository has been archived by the owner on Jun 9, 2023. It is now read-only.

chore: cancel event email content #1517

Merged
merged 20 commits into from
Nov 28, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions server/src/controllers/Events/resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,7 @@ ${venueDetails}`;
data: { canceled: true },
include: {
tags: { include: { tag: true } },
chapter: true,
event_users: {
include: { user: true },
where: {
Expand All @@ -710,17 +711,31 @@ ${venueDetails}`;
});
await deleteEventReminders(id);

const chapterURL = `${process.env.CLIENT_LOCATION}/chapters/${event.chapter.id}`;
const eventURL = `${process.env.CLIENT_LOCATION}/events/${event.id}?emaillink=true`;
Sboonny marked this conversation as resolved.
Show resolved Hide resolved
const notCanceledRsvps = event.event_users;

if (notCanceledRsvps.length) {
const emailList = notCanceledRsvps.map(({ user }) => user.email);
const subject = `Event ${event.name} canceled`;
const body = `The event ${event.name} was canceled`;
const subject = `Event ${event.name} is canceled`;
const cancelEventEmail = `The Upcoming Event for ${event.name} is canceled.<br />
Sboonny marked this conversation as resolved.
Show resolved Hide resolved
<br />
View Upcoming Events for ${event.chapter.name}: <a href='${chapterURL}'>${event.chapter.name} chapter</a>.<br />
----------------------------<br />
<br />
- Stop receiving upcoming event notifications for ${event.chapter.name}. you can do it here: <a href="${eventURL}">${eventURL}</a>.<br />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From event page, only further event notifications for that event can be changed. Seems that either wording or url needs to be changed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated it to this

- Stop receiving event notifications for ${event.name}. You can do it here: <a href="${eventURL}">${eventURL}</a>.<br />

But it maybe redundant, should we delete that line?

- More about ${event.chapter.name} or to unfollow this chapter: <a href="${chapterURL}">${chapterURL}</a>.<br />
<br />
----------------------------<br />
You received this email because you subscribed to ${event.name} Event.<br />
<br />
See the options above to change your notifications.
`;

new MailerService({
emailList: emailList,
subject: subject,
htmlEmail: body,
htmlEmail: cancelEventEmail,
}).sendEmail();
}

Expand Down