Open jom opened 3 years ago
The #3869 PR fixes this issue for legacy courses (handled by the modules meta box).
For course outline courses, I think we can fix it by skipping the Sensei_Teacher::update_course_modules_author
with a validation like:
// Skip if modules are handled by course outline block.
$course = get_post( $course_id );
if ( has_block( 'sensei-lms/course-outline', $course ) ) {
return;
}
But we would need to sync and re-save the blocks structure when changing the teacher too (see the subscribe
in the assets/blocks/course-outline/store.js
). It needs more exploration and tests, but I think the after #3862 is merged, the Sensei_Course_Structure
class will be enough to handle the stuff handled by Sensei_Teacher::update_course_modules_author
.
Adding a video for context of the pending issue:
https://user-images.githubusercontent.com/876340/130844024-fb3cc9e2-aedc-4f62-862d-2c96d7f751f1.mov
Noting here that this appears to only be a problem for "Draft" lessons. Published lessons do not get moved outside of their Modules.
For both legacy courses and course outline courses, modules break (lessons aren't assigned and strange things happen) when a teacher This happens for different reasons for both legacy courses and course outline courses, so we might want to break this work up.
Steps to Reproduce
What I Expected
Course structure not to change.
What Happened Instead
Lessons were removed from modules.
PHP / WordPress / Sensei LMS version
PHP 7.2 / WordPress 5.5 / Sensei LMS 3.5.2 (legacy) and Sensei LMS 3.6.0-beta.1 (block + legacy)
Browser / OS version
Chrome