Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FIX sysadmin editing user drops them from courses
When editing a user, a sysadmin can unknowingly drop them from courses on save. This is because the user controller expects the form submit to contain every single enrolment and this stops happening once you pass around 1000 courses. Missing enrolments not sent in the form submit are presumed to be the user dropping the course. While this can happen to any role that can edit another user, it's most likely to happen to sysadmins since they have access to every course. The main fix is to make sure existing enrolments are always in the list of enrolments to be processed. So missing enrolments not sent in the form submit gets defaulted to existing enrolments. We also limit enrolment changes to only the ones that are sent in the form submit. I tried not to change the behaviour too much, as iPeer is very sideffects prone and hard to work with. Example: we call removeStudent/Tutor/Instructor even if the user's role just changed, they didn't unenrol from the course entirely. I tried to keep that behavior even though I suspect there are problematic edge cases there.
- Loading branch information