-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: sanitize attendee status on create and specific changes #47308
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: SebastianKrupinski <[email protected]>
* @param mixed $modified | ||
* @param mixed $isNew | ||
*/ | ||
public function calendarObjectChange(RequestInterface $request, ResponseInterface $response, VCalendar $alteredObject, $calendarPath, &$modified, $isNew) { |
Check notice
Code scanning / Psalm
MissingReturnType Note
// 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 Error
/** @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 Error
/** @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 Error
|
||
} | ||
|
||
public function sanitizeCreatedInstance(VEvent $altered, $modified): void { |
Check notice
Code scanning / Psalm
MissingParamType Note
public function sanitizeEventAttendees(VEvent $event, $modified): void { | ||
|
||
// iterate thought attendees | ||
foreach ($event->ATTENDEE as $id => $entry) { |
Check notice
Code scanning / Psalm
PossiblyNullIterator Note
// 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 Error
// 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 Note
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 Note
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 Note
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 <[email protected]>
For reference: #42347 |
Summary
TODO
Checklist