Skip to content

Commit

Permalink
fixup! feat(ocp): add calendar api to retrieve availability of attendees
Browse files Browse the repository at this point in the history
  • Loading branch information
st3iny committed Jan 9, 2025
1 parent 86edbcb commit c725eca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 8 additions & 1 deletion lib/private/Calendar/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
use Sabre\HTTP\Response;
use Sabre\VObject\Component\VCalendar;
use Sabre\VObject\Component\VEvent;
use Sabre\VObject\Component\VFreeBusy;
use Sabre\VObject\Property\VCard\DateTime;
use Sabre\VObject\Reader;
use Throwable;
Expand Down Expand Up @@ -560,11 +561,17 @@ public function checkAvailability(
$mailtoLen,
);

$vfreebusy = $freeBusyResponseData->VFREEBUSY;
if (!($vfreebusy instanceof VFreeBusy)) {
continue;
}

// TODO: actually check values of FREEBUSY properties to find a free slot
$isAvailable = true;
$freeBusyProps = $freeBusyResponseData->VFREEBUSY->FREEBUSY;
$freeBusyProps = $vfreebusy->FREEBUSY;
if ($freeBusyProps !== null) {
foreach ($freeBusyProps as $prop) {
// BUSY is the default, in case FBTYPE is not present
if (isset($prop['FBTYPE']) && $prop['FBTYPE'] === 'FREE') {
continue;
}
Expand Down
2 changes: 0 additions & 2 deletions tests/lib/Calendar/ManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

namespace Test\Calendar;

use AdvancedJsonRpc\Request;
use DateTimeImmutable;
use OC\AppFramework\Bootstrap\Coordinator;
use OC\Calendar\AvailabilityResult;
Expand All @@ -28,7 +27,6 @@
use Psr\Log\LoggerInterface;
use Sabre\DAV\Exception\Forbidden;
use Sabre\HTTP\RequestInterface;
use Sabre\HTTP\Response;
use Sabre\HTTP\ResponseInterface;
use Sabre\VObject\Component\VCalendar;
use Sabre\VObject\Document;
Expand Down

0 comments on commit c725eca

Please sign in to comment.