Skip to content

Commit

Permalink
Merge branch 'main' into N21-1324-migration-page-buttons-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mrikallab committed Oct 4, 2023
2 parents d4fa9b8 + 2c876ea commit fd83994
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
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
2 changes: 1 addition & 1 deletion controllers/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ router.get('/courses/:courseId/:folderId?', FileGetter, async (req, res, next) =
courseId: req.params.courseId,
ownerId: req.params.courseId,
toCourseText: res.$t('global.button.toCourse'),
courseUrl: `/rooms/${req.params.courseId}/`,
courseUrl: `/rooms/${req.params.courseId}`,
canEditPermissions: true,
parentId: req.params.folderId,
...res.locals.files,
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 disabled=@root.course.isArchived 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

0 comments on commit fd83994

Please sign in to comment.