-
Improvement
-
Resolution: Fixed
-
Minor
-
4.2
-
MOODLE_402_STABLE
-
MOODLE_404_STABLE
-
MDL-77038-master -
-
2
-
HQ 2023 Sprint I4.1 Moppies
A bit of context
Since 4.0 the new course editor actions go through a standardized webservice called core_courseformat_update_course. All the actions available in this webservices are implemented as something called "state actions," and all of them use an object called "state updates" to generate the webservice return data structure.
One of the actions was called "section_move" which emulates the previous course editor behavior, and it is used for both moving sections with the dropdown "move" action and for drag&drop a section header.
The problem
The current "section_move" is quite ambiguous in its definition because the moved section will go below or above the target section, depending on its relative position. If the target section is below the moved section, it will go above while if the target is below the moved section will go below. This way of moving a section was ok for the limitations of the previous course editor but added extra complexity to the new one, especially with the introduction of bulk editing.
Since MDL-76894 the move section modal has a new design to make it consistent with the bulk action. This change requires the move modal always move the section under the target one using a new "section_move_under" action.
After MDL-76894 there are 2 different actions for moving a section:
- section_move: used only for drag&drop a section
- section_move_under: for moving a section using the individual section move action or the bulk move section action.
Needless to say that having two almost identical methods is not ideal or necessary. Apart, the definition of "section_move" was ambiguous compareted to "section_move_under".
Solution
The solution has two steps:
- Migrate the current section drag&drop to the move_seciton_under. This has the extra benefit that will improve the UX of the course editor as the section zero will start being an active dropzone (with the section_move, section zero should be excluded as a section item dropzone because it produces unexpected results).
- Start the process for deprecating the previous section_move. This action is not needed anymore and it is hardly improbable any third party format plugin uses it (and even then it is easily replaceable by the new one)