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
Udit Takkar 2023-03-08 17:28:09 +05:30 committed by GitHub
parent 29ceaee8d2
commit 84da528d4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 1 deletions

View File

@ -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}>`,