feat: add partstat, rsvp, role (#6940)
* feat: add partstat, rsvp, role Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in> * fix: type error Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in> --------- Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in> Co-authored-by: Peer Richelsen <peeroke@gmail.com>pull/7424/head^2
parent
29ceaee8d2
commit
84da528d4d
|
@ -1,4 +1,4 @@
|
|||
import type { DateArray } from "ics";
|
||||
import type { DateArray, ParticipationStatus, ParticipationRole } from "ics";
|
||||
import { createEvent } from "ics";
|
||||
import type { TFunction } from "next-i18next";
|
||||
import { RRule } from "rrule";
|
||||
|
@ -36,6 +36,8 @@ export default class AttendeeScheduledEmail extends BaseEmail {
|
|||
// ics appends "RRULE:" already, so removing it from RRule generated string
|
||||
recurrenceRule = new RRule(this.calEvent.recurringEvent).toString().replace("RRULE:", "");
|
||||
}
|
||||
const partstat: ParticipationStatus = "NEEDS-ACTION";
|
||||
const role: ParticipationRole = "REQ-PARTICIPANT";
|
||||
const icsEvent = createEvent({
|
||||
start: dayjs(this.calEvent.startTime)
|
||||
.utc()
|
||||
|
@ -52,14 +54,21 @@ export default class AttendeeScheduledEmail extends BaseEmail {
|
|||
...this.calEvent.attendees.map((attendee: Person) => ({
|
||||
name: attendee.name,
|
||||
email: attendee.email,
|
||||
partstat,
|
||||
role,
|
||||
rsvp: true,
|
||||
})),
|
||||
...(this.calEvent.team?.members
|
||||
? this.calEvent.team?.members.map((member: Person) => ({
|
||||
name: member.name,
|
||||
email: member.email,
|
||||
partstat,
|
||||
role,
|
||||
rsvp: true,
|
||||
}))
|
||||
: []),
|
||||
],
|
||||
method: "REQUEST",
|
||||
...{ recurrenceRule },
|
||||
status: "CONFIRMED",
|
||||
});
|
||||
|
@ -74,6 +83,7 @@ export default class AttendeeScheduledEmail extends BaseEmail {
|
|||
icalEvent: {
|
||||
filename: "event.ics",
|
||||
content: this.getiCalEventAsString(),
|
||||
method: "REQUEST",
|
||||
},
|
||||
to: `${this.attendee.name} <${this.attendee.email}>`,
|
||||
from: `${this.calEvent.organizer.name} <${this.getMailerOptions().from}>`,
|
||||
|
|
Loading…
Reference in New Issue