Skip to content

Commit 18d40ab

Browse files
committed
Merge branch 'wip-103824-m404' into MOODLE_404_STABLE
2 parents c76ad31 + 0dc555d commit 18d40ab

File tree

1 file changed

+15
-4
lines changed
  • local/o365/classes/feature/calsync

1 file changed

+15
-4
lines changed

local/o365/classes/feature/calsync/main.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -718,20 +718,31 @@ public function get_event_link_html($event) {
718718
*/
719719
public function calendar_exists(int $userid, string $outlookcalendarid): bool {
720720
try {
721+
if (empty($outlookcalendarid)) {
722+
return false;
723+
}
724+
721725
$apiclient = $this->construct_calendar_api($userid, true);
722726
$o365upn = utils::get_o365_upn($userid);
723-
if (empty($o365upn) || empty($outlookcalendarid)) {
724-
return false;
727+
728+
if (empty($o365upn)) {
729+
return true;
725730
}
726-
$calendars = $apiclient->get_calendars($o365upn) ?? [];
731+
732+
$calendars = $apiclient->get_calendars($o365upn);
733+
734+
if (empty($calendars)) {
735+
return true;
736+
}
737+
727738
foreach ($calendars as $calendar) {
728739
if (isset($calendar['id']) && $calendar['id'] === $outlookcalendarid) {
729740
return true;
730741
}
731742
}
732743
return false;
733744
} catch (moodle_exception $e) {
734-
return false;
745+
return true;
735746
}
736747
}
737748

0 commit comments

Comments
 (0)