-
Bug
-
Resolution: Fixed
-
Minor
-
3.4.6, 3.5.3, 3.6, 3.7.4, 3.8, 3.9
-
MOODLE_34_STABLE, MOODLE_35_STABLE, MOODLE_36_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE
-
MOODLE_37_STABLE, MOODLE_38_STABLE
-
MDL-64531-master-questiondeletejson -
If you delete a quiz activity with ajax enabled and it deletes the question category, the ajax response incorrectly includes HTML feedback
/lib/ajax/service.php?sesskey=blahblah&info=core_course_edit_module |
<table class="generaltable">
|
<thead>
|
<tr>
|
<th class="header c0" style="" scope="col">Category</th>
|
<th class="header c1 lastcol" style="" scope="col">Action</th>
|
</tr>
|
</thead>
|
<tbody><tr class="lastrow">
|
<td class="cell c0" style="">Default for Test Duplicate</td>
|
<td class="cell c1 lastcol" style="">This category has been deleted because, after deleting the course, its questions weren't used any more.</td>
|
</tr>
|
</tbody>
|
</table>
|
[{"error":false,"data":""}]
|
As expected, the on-screen error in Chrome is:
SyntaxError: Unexpected token < in JSON at position 0
|
The quiz is actually deleted as visible after a screen refresh, but the error is still causing confusion for instructors.
I think the proper fix is to set the "not async" flag in the question_delete_activity() function call here to prevent feedback from being shown:
course/lib.php::~1191 |
function course_delete_module($cmid, $async = false) { |
...
|
// Delete activity context questions and question categories. |
question_delete_activity($cm, !$async); |
- Testing discovered
-
MDL-67634 Need a better way to access PHPUNIT_TEST, CLI_SCRIPT, etc, so they can be mocked in unit tests
- Open