From 00f71dadbb621738d6267e0f8eaceec86c9d74a3 Mon Sep 17 00:00:00 2001
From: Moritz Strohm <strohm@data-quest.de>
Date: Mon, 18 Mar 2024 11:07:24 +0100
Subject: [PATCH] fixed saving of calendar dates for course calendars

---
 app/controllers/calendar/date.php | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/app/controllers/calendar/date.php b/app/controllers/calendar/date.php
index 51a9404936a..8c542b8ed0a 100644
--- a/app/controllers/calendar/date.php
+++ b/app/controllers/calendar/date.php
@@ -514,6 +514,9 @@ class Calendar_DateController extends AuthenticatedController
             if (($owner instanceof Course)) {
                 //Set the course as calendar:
                 $allowed_calendar_ids = [$owner->id];
+            } elseif (Context::isCourse()) {
+                //Set the course as allowed calendar:
+                $allowed_calendar_ids = [Context::getId()];
             } else {
                 //Assign the date to the calendars of all the selected users:
                 $allowed_calendar_ids = [$GLOBALS['user']->id];
-- 
GitLab