From 59899a7978f102cd48d3eb0a07d414d56bd74b03 Mon Sep 17 00:00:00 2001 From: Theodor Truffer Date: Thu, 27 Feb 2020 14:09:43 +0100 Subject: [PATCH 1/4] 0027702: Automatic notifications don't work for new course members when forum is inside a folder --- Modules/Forum/classes/class.ilForumNotification.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Modules/Forum/classes/class.ilForumNotification.php b/Modules/Forum/classes/class.ilForumNotification.php index 75cec7a4cd12..844fd2e58e7c 100644 --- a/Modules/Forum/classes/class.ilForumNotification.php +++ b/Modules/Forum/classes/class.ilForumNotification.php @@ -277,7 +277,11 @@ public static function getCachedNodeData($ref_id) { if (!array_key_exists($ref_id, self::$node_data_cache)) { global $DIC; - self::$node_data_cache[$ref_id] = $DIC->repositoryTree()->getChildsByType($ref_id, 'frm'); + self::$node_data_cache[$ref_id] = $DIC->repositoryTree()->getSubTree( + $DIC->repositoryTree()->getNodeData($ref_id), + true, + 'frm' + ); } return self::$node_data_cache[$ref_id]; From b8d63579431d315f6436f1869b80891b7bb6debd Mon Sep 17 00:00:00 2001 From: Theodor Truffer Date: Thu, 5 Mar 2020 11:43:23 +0100 Subject: [PATCH 2/4] 0027702 (part 2) --- Modules/Forum/classes/class.ilForumNotification.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Modules/Forum/classes/class.ilForumNotification.php b/Modules/Forum/classes/class.ilForumNotification.php index 844fd2e58e7c..64949cbcf8f6 100644 --- a/Modules/Forum/classes/class.ilForumNotification.php +++ b/Modules/Forum/classes/class.ilForumNotification.php @@ -277,11 +277,21 @@ public static function getCachedNodeData($ref_id) { if (!array_key_exists($ref_id, self::$node_data_cache)) { global $DIC; - self::$node_data_cache[$ref_id] = $DIC->repositoryTree()->getSubTree( + $node_data = $DIC->repositoryTree()->getSubTree( $DIC->repositoryTree()->getNodeData($ref_id), true, 'frm' ); + $node_data = array_filter($node_data, function ($forum_node) use ($DIC, $ref_id) { + // filter out forum if a grp lies in the path (#0027702) + foreach ($DIC->repositoryTree()->getNodePath($forum_node['child'], $ref_id) as $path_node) { + if ($path_node['child'] !== $ref_id && $path_node['type'] == 'grp') { + return false; + } + } + return true; + }); + self::$node_data_cache[$ref_id] = $node_data; } return self::$node_data_cache[$ref_id]; From cbb7255b6b48dff79931fd15da226c2be323b633 Mon Sep 17 00:00:00 2001 From: Theodor Truffer Date: Thu, 5 Mar 2020 13:18:53 +0100 Subject: [PATCH 3/4] 0027702 (part 3) --- Modules/Forum/classes/class.ilForumNotification.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Forum/classes/class.ilForumNotification.php b/Modules/Forum/classes/class.ilForumNotification.php index 64949cbcf8f6..044af5d15875 100644 --- a/Modules/Forum/classes/class.ilForumNotification.php +++ b/Modules/Forum/classes/class.ilForumNotification.php @@ -285,7 +285,7 @@ public static function getCachedNodeData($ref_id) $node_data = array_filter($node_data, function ($forum_node) use ($DIC, $ref_id) { // filter out forum if a grp lies in the path (#0027702) foreach ($DIC->repositoryTree()->getNodePath($forum_node['child'], $ref_id) as $path_node) { - if ($path_node['child'] !== $ref_id && $path_node['type'] == 'grp') { + if ((int) $path_node['child'] !== $ref_id && $path_node['type'] === 'grp') { return false; } } From 5f133df7e9ef2471789f76f74e508896418d8241 Mon Sep 17 00:00:00 2001 From: Theodor Truffer Date: Thu, 5 Mar 2020 14:52:58 +0100 Subject: [PATCH 4/4] 0027702 (part 3) --- Modules/Forum/classes/class.ilForumNotification.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Forum/classes/class.ilForumNotification.php b/Modules/Forum/classes/class.ilForumNotification.php index 044af5d15875..f8562ac4ebe3 100644 --- a/Modules/Forum/classes/class.ilForumNotification.php +++ b/Modules/Forum/classes/class.ilForumNotification.php @@ -285,7 +285,7 @@ public static function getCachedNodeData($ref_id) $node_data = array_filter($node_data, function ($forum_node) use ($DIC, $ref_id) { // filter out forum if a grp lies in the path (#0027702) foreach ($DIC->repositoryTree()->getNodePath($forum_node['child'], $ref_id) as $path_node) { - if ((int) $path_node['child'] !== $ref_id && $path_node['type'] === 'grp') { + if ((int) $path_node['child'] !== (int) $ref_id && $path_node['type'] === 'grp') { return false; } }