fix: sanitize attendee status on create and specific changes#47308
fix: sanitize attendee status on create and specific changes#47308SebastianKrupinski wants to merge 2 commits intomasterfrom
Conversation
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
| * @param mixed $modified | ||
| * @param mixed $isNew | ||
| */ | ||
| public function calendarObjectChange(RequestInterface $request, ResponseInterface $response, VCalendar $alteredObject, $calendarPath, &$modified, $isNew) { |
Check notice
Code scanning / Psalm
MissingReturnType
| // determine if altered calendar event is a new | ||
| // if calendar event is new sanitize and exit | ||
| if ($isNew) { | ||
| $this->sanitizeCreatedInstance($alteredObject->VEVENT, $modified); |
Check failure
Code scanning / Psalm
InvalidArgument
| /** @var \Sabre\VObject\Component\VCalendar $currentObject */ | ||
| $currentObject = Reader::read($currentNode->get()); | ||
| // find what has changed (base, recurrence, both) between altered and current calendar event | ||
| $delta = $this->findEventInstanceDelta($alteredObject->VEVENT, $currentObject->VEVENT); |
Check failure
Code scanning / Psalm
InvalidArgument
| /** @var \Sabre\VObject\Component\VCalendar $currentObject */ | ||
| $currentObject = Reader::read($currentNode->get()); | ||
| // find what has changed (base, recurrence, both) between altered and current calendar event | ||
| $delta = $this->findEventInstanceDelta($alteredObject->VEVENT, $currentObject->VEVENT); |
Check failure
Code scanning / Psalm
InvalidArgument
|
|
||
| } | ||
|
|
||
| public function sanitizeCreatedInstance(VEvent $altered, $modified): void { |
Check notice
Code scanning / Psalm
MissingParamType
| public function sanitizeEventAttendees(VEvent $event, $modified): void { | ||
|
|
||
| // iterate thought attendees | ||
| foreach ($event->ATTENDEE as $id => $entry) { |
Check notice
Code scanning / Psalm
PossiblyNullIterator
| // determine attendee participation status | ||
| // if status is missing or NOT set correctly change the status | ||
| if (!isset($entry['PARTSTAT']) || $entry['PARTSTAT']->getValue() !== 'NEEDS-ACTION') { | ||
| $event->ATTENDEE[$id]['PARTSTAT']->setValue('NEEDS-ACTION'); |
Check failure
Code scanning / Psalm
InvalidArgument
| // determine if id exists in list | ||
| if (isset($list[$id])) { | ||
| // compare altered instance to current instance | ||
| if ($list[$id]['altered']->{'LAST-MODIFIED'}->getValue() == $event->{'LAST-MODIFIED'}->getValue() && |
Check notice
Code scanning / Psalm
PossiblyNullReference
| if (isset($list[$id])) { | ||
| // compare altered instance to current instance | ||
| if ($list[$id]['altered']->{'LAST-MODIFIED'}->getValue() == $event->{'LAST-MODIFIED'}->getValue() && | ||
| $list[$id]['altered']->SEQUENCE->getValue() == $event->SEQUENCE->getValue()) { |
Check notice
Code scanning / Psalm
PossiblyNullPropertyFetch
| if (isset($list[$id])) { | ||
| // compare altered instance to current instance | ||
| if ($list[$id]['altered']->{'LAST-MODIFIED'}->getValue() == $event->{'LAST-MODIFIED'}->getValue() && | ||
| $list[$id]['altered']->SEQUENCE->getValue() == $event->SEQUENCE->getValue()) { |
Check notice
Code scanning / Psalm
PossiblyNullReference
Testing StepsCreate Test
Attendee participation status should be reset to "NEEDS-ACTION" Update Test
Attendee participation status should be reset to "NEEDS-ACTION" |
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
|
For reference: #42347 |
Summary
TODO
Checklist