Skip to content

Commit

Permalink
Use withmetadata query parameter when necessary only
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Kollenbroich committed Oct 23, 2023
1 parent c42fc7a commit e2d6194
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions classes/local/apibridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,10 @@ public function get_upload_xml_file($filename, $filedata) {
* to display a "more videos" link.
*
* @param int $courseid
* @param bool $withmetada
* @return \stdClass
*/
public function get_block_videos($courseid) {
public function get_block_videos($courseid, $withmetada = true) {

$result = new \stdClass();
$result->count = 0;
Expand All @@ -321,7 +322,7 @@ public function get_block_videos($courseid) {
$params = [
'sign' => true,
'withacl' => true,
'withmetadata' => true,
'withmetadata' => $withmetada === true,
'withpublications' => true,
'sort' => [
'start_date' => 'DESC'
Expand Down Expand Up @@ -403,9 +404,10 @@ public function get_course_videos($courseid, $sortcolumns = null) {
*
* @param string $series
* @param string $sortcolumns
* @param bool $withmetada
* @return array
*/
public function get_series_videos($series, $sortcolumns = null) {
public function get_series_videos($series, $sortcolumns = null, $withmetadata = true) {

$result = new \stdClass();
$result->videos = array();
Expand All @@ -414,7 +416,7 @@ public function get_series_videos($series, $sortcolumns = null) {
$params = [
'sign' => true,
'withacl' => true,
'withmetadata' => true,
'withmetadata' => $withmetadata === true,
'withpublications' => true,
];

Expand Down
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@
$errors = 0;

foreach ($courseseries as $series) {
$seriesvideodata[$series->series] = $opencast->get_series_videos($series->series, $sortcolumns);
$seriesvideodata[$series->series] = $opencast->get_series_videos($series->series, $sortcolumns, false);
if ($seriesvideodata[$series->series]->error) {
$errors += 1;
}
Expand Down
2 changes: 1 addition & 1 deletion overview_videos.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
get_string('heading_actions', 'block_opencast'));
$table = $renderer->create_overview_videos_table('ignore', $headers, $columns, $baseurl);

$videos = $apibridge->get_series_videos($series)->videos;
$videos = $apibridge->get_series_videos($series, null, false)->videos;
$activityinstalled = \core_plugin_manager::instance()->get_plugin_info('mod_opencast') != null;
$showchangeownerlink = has_capability('block/opencast:viewusers', context_system::instance()) &&
!empty(get_config('block_opencast', 'aclownerrole_' . $ocinstanceid));
Expand Down

0 comments on commit e2d6194

Please sign in to comment.