From 6f7ac05324d60ae0500b6887a87966df2b75e90a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Till=20Gl=C3=B6ggler?= <till@gundk.it>
Date: Fri, 26 May 2023 12:46:38 +0200
Subject: [PATCH] fixes #1829

---
 lib/activities/Context.php | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/activities/Context.php b/lib/activities/Context.php
index 9f7978f521f..17055287266 100644
--- a/lib/activities/Context.php
+++ b/lib/activities/Context.php
@@ -17,7 +17,7 @@ abstract class Context
         'participants',
         'schedule',
         'wiki',
-        'courseware', 
+        'courseware',
         'forum'
     ];
 
@@ -86,6 +86,11 @@ abstract class Context
         $params = [$this->getContextType(), $this->getRangeId(), $filter->getStartDate(), $filter->getEndDate()];
 
         if ($filter->getContext() !== null && $filter->getContextId() !== null) {
+            // if a single context is provided and this context does not match, do not return any activites
+            if ($this->getRangeId() != $filter->getContextId()) {
+                return null;
+            }
+
             $params = [$filter->getContext(), $filter->getContextId(), $filter->getStartDate(), $filter->getEndDate()];
         }
 
-- 
GitLab