File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed
local/o365/classes/feature/calsync Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments