From 1201e59f6f7fab68cded1c5da46a7e807bc7dd53 Mon Sep 17 00:00:00 2001 From: Ron Lucke <lucke@elan-ev.de> Date: Mon, 21 Feb 2022 10:28:01 +0000 Subject: [PATCH] biest #657 --- .../JsonApi/Routes/ActivityStreamShow.php | 25 +++++++++++++------ .../vue/store/courseware/courseware.module.js | 6 ++--- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/lib/classes/JsonApi/Routes/ActivityStreamShow.php b/lib/classes/JsonApi/Routes/ActivityStreamShow.php index 2a1a5574d30..14470dfdab6 100644 --- a/lib/classes/JsonApi/Routes/ActivityStreamShow.php +++ b/lib/classes/JsonApi/Routes/ActivityStreamShow.php @@ -27,7 +27,7 @@ class ActivityStreamShow extends JsonApiController { protected $allowedIncludePaths = ['actor', 'context', 'object']; - protected $allowedFilteringParameters = ['start', 'end', 'activity-type']; + protected $allowedFilteringParameters = ['start', 'end', 'activity-type', 'context-type', 'context-id', 'object-type', 'object-id']; protected $allowedPagingParameters = ['offset', 'limit']; @@ -69,13 +69,21 @@ class ActivityStreamShow extends JsonApiController 'start' => strtotime('-6 months'), 'end' => time(), 'activity-type' => null, + 'context-type' => null, + 'context-id' => null, + 'object-type' => null, + 'object-id' => null ]; $filter = array_reduce( - words('start end'), + words('start end activity-type context-type context-id object-type object-id'), function ($filter, $key) use ($filtering) { if (isset($filtering[$key])) { - $filter[$key] = (int) $filtering[$key]; + if ($key === 'start' || $key === 'end') { + $filter[$key] = (int) $filtering[$key]; + } else { + $filter[$key] = $filtering[$key]; + } } return $filter; @@ -83,10 +91,6 @@ class ActivityStreamShow extends JsonApiController $filter ); - if (isset($filtering['activity-type'])) { - $filter['activity-type'] = $filtering['activity-type']; - } - return $filter; } @@ -133,7 +137,8 @@ class ActivityStreamShow extends JsonApiController 'news', 'participants', 'schedule', - 'wiki' + 'wiki', + 'courseware' ] ); } @@ -146,6 +151,10 @@ class ActivityStreamShow extends JsonApiController $filter->setStartDate($urlFilter['start']); $filter->setEndDate($urlFilter['end']); + $filter->setContext($urlFilter['context-type']); + $filter->setContextId($urlFilter['context-id']); + $filter->setObjectType($urlFilter['object-type']); + $filter->setObjectId($urlFilter['object-id']); return $filter; } diff --git a/resources/vue/store/courseware/courseware.module.js b/resources/vue/store/courseware/courseware.module.js index dd806598117..88e5e2a65ca 100755 --- a/resources/vue/store/courseware/courseware.module.js +++ b/resources/vue/store/courseware/courseware.module.js @@ -245,9 +245,9 @@ export const actions = { const relationship = 'activitystream'; const options = { - 'filter[context_type]': 'course', - 'filter[context_id]': courseId, - 'filter[object_type]': 'courseware', + 'filter[context-type]': 'course', + 'filter[context-id]': courseId, + 'filter[object-type]': 'courseware', include: 'actor, context, object', }; -- GitLab