-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Anton Lilleby
authored and
Anton Lilleby
committed
Jan 15, 2025
1 parent
9213c0a
commit 58eb4e8
Showing
13 changed files
with
8 additions
and
344 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,5 @@ | ||
import ical, { | ||
ICalAlarmType, | ||
ICalAttendeeRole, | ||
ICalAttendeeStatus, | ||
ICalCalendarMethod, | ||
} from "ical-generator"; | ||
import { toHTML } from "@portabletext/to-html"; | ||
import { composeEmail, sendEmail, wrapWithStyles } from "../nodemailer"; | ||
import ical, { ICalAttendeeRole, ICalAttendeeStatus, ICalCalendarMethod } from "ical-generator"; | ||
import { composeEmail, sendEmail } from "../nodemailer"; | ||
import { PUBLIC_APP_BASE_URL } from "$env/static/public"; | ||
import type { EventUpdatedProps } from "../../../routes/api/send-event-updated/+server"; | ||
|
||
|
@@ -35,31 +29,9 @@ const createIcsFile = ({ | |
end, | ||
location, | ||
organiser, | ||
reminder, | ||
}: EmailAcceptedProps) => { | ||
const url = `${PUBLIC_APP_BASE_URL}/event/${id}`; | ||
const calendar = ical({ name: organiser, method: ICalCalendarMethod.REQUEST }); | ||
const alarms = []; | ||
|
||
if (reminder.hasThreeDaysBefore) { | ||
alarms.push({ | ||
type: ICalAlarmType.email, | ||
summary: reminder.threeDaysSubject, | ||
description: reminder.threeDaysMessage | ||
? wrapWithStyles(toHTML(reminder.threeDaysMessage)) | ||
: "", | ||
trigger: 259200, // ->3 days before event starts | ||
}); | ||
} | ||
|
||
if (reminder.hasOneHourBefore) { | ||
alarms.push({ | ||
type: ICalAlarmType.email, | ||
summary: reminder.oneHourSubject, | ||
description: reminder.oneHourMessage ? wrapWithStyles(toHTML(reminder.oneHourMessage)) : "", | ||
trigger: 3600, // -> 1 hour before event starts | ||
}); | ||
} | ||
|
||
calendar.createEvent({ | ||
id, | ||
|
@@ -80,7 +52,6 @@ const createIcsFile = ({ | |
name: organiser === "Alle" ? "Capra Gruppen" : organiser, | ||
email: "[email protected]", | ||
}, | ||
alarms, | ||
}); | ||
|
||
return Buffer.from(calendar.toString()); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.