sensei icon indicating copy to clipboard operation
sensei copied to clipboard

Fix Course Teacher going out of sync with Course Lessons

Open markcummins opened this issue 1 year ago • 2 comments

Resolves #7599

Proposed Changes

This code syncs the Lesson Author and the Course Author (or Course Teacher). It ensures that the lesson author is the same as the course author, and makes sure that the current Course Teacher is able to access and edit all of the lessons in the course.

Testing Instructions

  1. Create a New Course and Lessons (e.g. Lesson A and Lesson B)
  2. Set the Course Teacher to be another User
  3. Add another Lesson and assign it to the Course (e.g. Lesson C)
  4. Log in as the Course Teacher

Before the update, the course teacher would not be able to edit Lesson C, as they would not be the Author of the lesson. After the update, they would be able to edit all the lessons in the course.

Pre-Merge Checklist

  • [ ] PR title and description contain sufficient detail and accurately describe the changes
  • [ ] Acceptance criteria is met
  • [ ] Decisions are publicly documented
  • [ ] Adheres to coding standards (PHP, JavaScript, CSS, HTML)
  • [ ] All strings are translatable (without concatenation, handles plurals)
  • [ ] Follows our naming conventions (P6rkRX-4oA-p2)
  • [ ] Hooks (p6rkRX-1uS-p2) and functions are documented
  • [ ] New UIs are responsive and use a mobile-first approach
  • [ ] New UIs match the designs
  • [ ] Different user privileges (admin, teacher, subscriber) are tested as appropriate
  • [ ] Legacy courses (course without blocks) are tested
  • [ ] Code is tested on the minimum supported PHP and WordPress versions
  • [ ] User interface changes have been tested on the latest versions of Chrome, Firefox and Safari
  • [ ] "Needs Documentation" label is added if this change requires updates to documentation
  • [ ] Known issues are created as new GitHub issues

markcummins avatar Apr 25 '24 15:04 markcummins

Hi @markcummins!

Thanks for the contribution. I tested the PR and it works well.

Could you please address the issues from the PR checks:

  • PHP Linting and Tests: https://github.com/Automattic/sensei/actions/runs/8834983974/job/24258014735?pr=7600
  • Psalm Test: https://github.com/Automattic/sensei/actions/runs/8834983993/job/24258021532?pr=7600
  • Changelogger checks: https://github.com/Automattic/sensei/actions/runs/8834983972/job/24258024592?pr=7600

As for the changelogger, you need to add a changelog entry. For this purpose,

  • Run the following command in the repo directory and follow the instructions: composer exec changelogger add.
  • Commit and push the changes.

merkushin avatar May 17 '24 00:05 merkushin

Hi, apologies for not following up on this and thanks for your instructions. I set up the environment properly locally so I could run the tests. This last commit should fix the three tests that were failing.

markcummins avatar Jun 04 '24 08:06 markcummins