Skip to content

Commit

Permalink
fix(CalendarObjectInstance): reset attendee participation status on d…
Browse files Browse the repository at this point in the history
…uplication of an event

Signed-off-by: Grigory Vodyanov <[email protected]>
  • Loading branch information
GVodyanov committed Aug 29, 2024
1 parent 6f5f321 commit 32ba28e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/models/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,9 @@ const mapEventComponentToEventObject = (eventComponent) => {
*
* @param {object} eventObject The calendar-object-instance object
* @param {EventComponent} eventComponent The calendar-js EventComponent object
* @param {boolean} resetAttendeeStatus Whether or not to reset the attendee status
*/
const copyCalendarObjectInstanceIntoEventComponent = (eventObject, eventComponent) => {
const copyCalendarObjectInstanceIntoEventComponent = (eventObject, eventComponent, resetAttendeeStatus = false) => {
eventComponent.title = eventObject.title
eventComponent.location = eventObject.location
eventComponent.description = eventObject.description
Expand All @@ -206,6 +207,11 @@ const copyCalendarObjectInstanceIntoEventComponent = (eventObject, eventComponen
}

for (const attendee of eventObject.attendees) {
if (resetAttendeeStatus) {
attendee.attendeeProperty.participationStatus = "NEEDS-ACTION"
attendee.attendeeProperty.rsvp = true
}

eventComponent.addProperty(attendee.attendeeProperty)
}

Expand Down
2 changes: 1 addition & 1 deletion src/store/calendarObjectInstance.js
Original file line number Diff line number Diff line change
Expand Up @@ -1478,7 +1478,7 @@ export default defineStore('calendarObjectInstance', {
isAllDay: oldEventComponent.isAllDay(),
})
const eventComponent = getObjectAtRecurrenceId(calendarObject, startDate.jsDate)
copyCalendarObjectInstanceIntoEventComponent(oldCalendarObjectInstance, eventComponent)
copyCalendarObjectInstanceIntoEventComponent(oldCalendarObjectInstance, eventComponent, true)
const calendarObjectInstance = mapEventComponentToEventObject(eventComponent)

await this.setCalendarObjectInstanceForNewEvent({
Expand Down

0 comments on commit 32ba28e

Please sign in to comment.