Skip to content
Snippets Groups Projects
Commit 1201e59f authored by Ron Lucke's avatar Ron Lucke
Browse files

biest #657

parent c2cdc2ab
No related branches found
No related tags found
No related merge requests found
...@@ -27,7 +27,7 @@ class ActivityStreamShow extends JsonApiController ...@@ -27,7 +27,7 @@ class ActivityStreamShow extends JsonApiController
{ {
protected $allowedIncludePaths = ['actor', 'context', 'object']; 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']; protected $allowedPagingParameters = ['offset', 'limit'];
...@@ -69,13 +69,21 @@ class ActivityStreamShow extends JsonApiController ...@@ -69,13 +69,21 @@ class ActivityStreamShow extends JsonApiController
'start' => strtotime('-6 months'), 'start' => strtotime('-6 months'),
'end' => time(), 'end' => time(),
'activity-type' => null, 'activity-type' => null,
'context-type' => null,
'context-id' => null,
'object-type' => null,
'object-id' => null
]; ];
$filter = array_reduce( $filter = array_reduce(
words('start end'), words('start end activity-type context-type context-id object-type object-id'),
function ($filter, $key) use ($filtering) { function ($filter, $key) use ($filtering) {
if (isset($filtering[$key])) { if (isset($filtering[$key])) {
if ($key === 'start' || $key === 'end') {
$filter[$key] = (int) $filtering[$key]; $filter[$key] = (int) $filtering[$key];
} else {
$filter[$key] = $filtering[$key];
}
} }
return $filter; return $filter;
...@@ -83,10 +91,6 @@ class ActivityStreamShow extends JsonApiController ...@@ -83,10 +91,6 @@ class ActivityStreamShow extends JsonApiController
$filter $filter
); );
if (isset($filtering['activity-type'])) {
$filter['activity-type'] = $filtering['activity-type'];
}
return $filter; return $filter;
} }
...@@ -133,7 +137,8 @@ class ActivityStreamShow extends JsonApiController ...@@ -133,7 +137,8 @@ class ActivityStreamShow extends JsonApiController
'news', 'news',
'participants', 'participants',
'schedule', 'schedule',
'wiki' 'wiki',
'courseware'
] ]
); );
} }
...@@ -146,6 +151,10 @@ class ActivityStreamShow extends JsonApiController ...@@ -146,6 +151,10 @@ class ActivityStreamShow extends JsonApiController
$filter->setStartDate($urlFilter['start']); $filter->setStartDate($urlFilter['start']);
$filter->setEndDate($urlFilter['end']); $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; return $filter;
} }
......
...@@ -245,9 +245,9 @@ export const actions = { ...@@ -245,9 +245,9 @@ export const actions = {
const relationship = 'activitystream'; const relationship = 'activitystream';
const options = { const options = {
'filter[context_type]': 'course', 'filter[context-type]': 'course',
'filter[context_id]': courseId, 'filter[context-id]': courseId,
'filter[object_type]': 'courseware', 'filter[object-type]': 'courseware',
include: 'actor, context, object', include: 'actor, context, object',
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment