Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BC-5132 - Fix course until date bug #3317

Merged
merged 5 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions controllers/courses.js
Original file line number Diff line number Diff line change
Expand Up @@ -774,9 +774,14 @@ router.patch('/:courseId', async (req, res, next) => {
}
const { courseId } = req.params;

const isAdministrator = res.locals.currentRole === 'Administrator';
const currentUserId = res.locals.currentUser._id;
const isRemovingYourself = !req.body.teacherIds.some((id) => id === currentUserId)
&& !req.body.substitutionIds.some((id) => id === currentUserId);
const isRemovingYourself = !isAdministrator
&& req.body.teacherIds
&& req.body.substitutionIds
&& !req.body.teacherIds.some((id) => id === currentUserId)
&& !req.body.substitutionIds.some((id) => id === currentUserId);

if (isRemovingYourself) {
// if you are removing yourself from a course you will not have permissions to create events anymore
// so temporarily add yourself to the list of teachers
Expand Down
1 change: 1 addition & 0 deletions views/courses/edit-course.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<div class="row">
<div class="form-group col-md-6">
{{> "lib/forms/form-date-input" label=($t "global.label.from") id="startDate" value=course.startDate [email protected] ariaLabel=($t "administration.global.label.timeSpan") }}
</div>
<div class="form-group col-md-6">
{{> "lib/forms/form-date-input" label=($t "global.label.to") id="untilDate" value=course.untilDate minDate=(datePickerTodayMinus 0 0 0) ariaLabel=($t "administration.global.label.timeSpan")}}
</div>
Expand Down
Loading