From 5148154d2eae0a0072825b4f4d1107648862363b Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Mon, 12 Oct 2020 12:24:41 +0100 Subject: [PATCH] MDL-69809 mod_folder: include forcedownload setting in WS responses. --- mod/folder/classes/external.php | 1 + mod/folder/tests/externallib_test.php | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/mod/folder/classes/external.php b/mod/folder/classes/external.php index 81ccfc95ef3..46d36fb27cb 100644 --- a/mod/folder/classes/external.php +++ b/mod/folder/classes/external.php @@ -197,6 +197,7 @@ class mod_folder_external extends external_api { 'display' => new external_value(PARAM_INT, 'Display type of folder contents on a separate page or inline'), 'showexpanded' => new external_value(PARAM_INT, '1 = expanded, 0 = collapsed for sub-folders'), 'showdownloadfolder' => new external_value(PARAM_INT, 'Whether to show the download folder button'), + 'forcedownload' => new external_value(PARAM_INT, 'Whether file download is forced'), 'section' => new external_value(PARAM_INT, 'Course section id'), 'visible' => new external_value(PARAM_INT, 'Module visibility'), 'groupmode' => new external_value(PARAM_INT, 'Group mode'), diff --git a/mod/folder/tests/externallib_test.php b/mod/folder/tests/externallib_test.php index 912a3d682b0..8b03ddbfe65 100644 --- a/mod/folder/tests/externallib_test.php +++ b/mod/folder/tests/externallib_test.php @@ -131,11 +131,13 @@ class mod_folder_external_testcase extends externallib_advanced_testcase { // First folder. $record = new stdClass(); $record->course = $course1->id; + $record->forcedownload = 1; $folder1 = self::getDataGenerator()->create_module('folder', $record); // Second folder. $record = new stdClass(); $record->course = $course2->id; + $record->forcedownload = 0; $folder2 = self::getDataGenerator()->create_module('folder', $record); // Execute real Moodle enrolment as we'll call unenrol() method on the instance later. @@ -154,7 +156,7 @@ class mod_folder_external_testcase extends externallib_advanced_testcase { // Create what we expect to be returned when querying the two courses. $expectedfields = array('id', 'coursemodule', 'course', 'name', 'intro', 'introformat', 'introfiles', 'revision', 'timemodified', 'display', 'showexpanded', 'showdownloadfolder', 'section', 'visible', - 'groupmode', 'groupingid'); + 'forcedownload', 'groupmode', 'groupingid'); // Add expected coursemodule and data. $folder1->coursemodule = $folder1->cmid;