From 5107b5bcfcdccc877bab8caeb29a4f9b81203e5c Mon Sep 17 00:00:00 2001 From: Conn Warwicker Date: Wed, 15 Jan 2025 15:11:04 +0000 Subject: [PATCH] MDL-84193 qbank_bulkmove: Disable bulkmove on history page. This removes the option to bulk move questions from the question history page. --- .../bank/bulkmove/classes/plugin_feature.php | 11 ++++++++--- .../bank/bulkmove/tests/behat/bulk_move.feature | 17 ++++------------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/question/bank/bulkmove/classes/plugin_feature.php b/question/bank/bulkmove/classes/plugin_feature.php index ff0ae9bf3d5..05de4cca79e 100644 --- a/question/bank/bulkmove/classes/plugin_feature.php +++ b/question/bank/bulkmove/classes/plugin_feature.php @@ -35,8 +35,13 @@ class plugin_feature extends plugin_features_base { * @return bulk_move_action[] */ public function get_bulk_actions(view $qbank): array { - return [ - new bulk_move_action($qbank), - ]; + // Don't return bulkmove if we are on the question history page. + if ($qbank->is_listing_specific_versions()) { + return []; + } else { + return [ + new bulk_move_action($qbank), + ]; + } } } diff --git a/question/bank/bulkmove/tests/behat/bulk_move.feature b/question/bank/bulkmove/tests/behat/bulk_move.feature index d1b15cb014a..855992d4811 100644 --- a/question/bank/bulkmove/tests/behat/bulk_move.feature +++ b/question/bank/bulkmove/tests/behat/bulk_move.feature @@ -124,19 +124,10 @@ Feature: Use the qbank plugin manager page for bulkmove And I should not see "Question 3" @javascript - Scenario: Move a question from one bank category to another from the history page. - Given I am on the "Test quiz" "mod_quiz > question bank" page logged in as teacher1 + Scenario: Unable to bulk move questions from history page + Given I am on the "Test quiz" "mod_quiz > question bank" page logged in as "teacher1" And I choose "History" action for "First question" in the question bank And I click on "First question" "checkbox" And I click on "With selected" "button" - When I press "Move to" - # Select a different category to move the questions into. - And I open the autocomplete suggestions list in the ".search-categories" "css_element" - And I click on "Test questions 6" item in the autocomplete list - And I press "Move questions" - And I click on "Confirm" "button" - # Then go check that new category, as we'll still be on history page here. - And I am on the "Test quiz" "mod_quiz > question bank" page - And I apply question bank filter "Category" with value "Test questions 6" - # Confirm that selected questions are moved to selected category while unselected questions are not moved. - Then I should see "First question" + Then I should see question bulk action "deleteselected" + And I should not see question bulk action "move"