From 762616562176c7db0ee64292c5174ac383aecf7c Mon Sep 17 00:00:00 2001
From: Ron Lucke <lucke@elan-ev.de>
Date: Fri, 21 Oct 2022 07:19:18 +0000
Subject: [PATCH] Biest #1651

Closes #1651

Merge request studip/studip!1098
---
 .../vue/components/courseware/CoursewareActionWidget.vue    | 3 ++-
 .../components/courseware/CoursewareStructuralElement.vue   | 6 +++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/resources/vue/components/courseware/CoursewareActionWidget.vue b/resources/vue/components/courseware/CoursewareActionWidget.vue
index 7279bdb4c2e..7ae74792038 100644
--- a/resources/vue/components/courseware/CoursewareActionWidget.vue
+++ b/resources/vue/components/courseware/CoursewareActionWidget.vue
@@ -15,7 +15,7 @@
                 <translate>Seite bearbeiten</translate>
             </button>
         </li>
-        <li v-if="canEdit && blockedByAnotherUser" class="cw-action-widget-remove-lock">
+        <li v-if="canEdit && blockedByAnotherUser && userIsTeacher" class="cw-action-widget-remove-lock">
             <button @click="removeElementLock">
                 <translate>Sperre aufheben</translate>
             </button>
@@ -63,6 +63,7 @@ export default {
     computed: {
         ...mapGetters({
             userId: 'userId',
+            userIsTeacher: 'userIsTeacher',
             consumeMode: 'consumeMode',
             showToolbar: 'showToolbar',
 
diff --git a/resources/vue/components/courseware/CoursewareStructuralElement.vue b/resources/vue/components/courseware/CoursewareStructuralElement.vue
index 13143f9a8c5..be79824eb26 100755
--- a/resources/vue/components/courseware/CoursewareStructuralElement.vue
+++ b/resources/vue/components/courseware/CoursewareStructuralElement.vue
@@ -79,7 +79,7 @@
                                 mood="pointing"
                             >
                                 <template #companionActions>
-                                    <button class="button" @click="menuAction('removeLock')">
+                                    <button v-if="userIsTeacher" class="button" @click="menuAction('removeLock')">
                                         {{ textRemoveLock.title }}
                                     </button>
                                 </template>
@@ -836,7 +836,7 @@ export default {
                 { id: 5, label: this.$gettext('Lesezeichen setzen'), icon: 'star', emit: 'setBookmark' },
             ];
             if (this.canEdit) {
-                if (!this.blocked) {
+                if (!this.blockedByAnotherUser) {
                     menu.push({
                         id: 1,
                         label: this.$gettext('Seite bearbeiten'),
@@ -850,7 +850,7 @@ export default {
                         emit: 'sortContainers',
                     });
                 }
-                if (this.blocked && this.blockedByAnotherUser && this.userIsTeacher) {
+                if (this.blockedByAnotherUser && this.userIsTeacher) {
                     menu.push({
                         id: 1,
                         label: this.textRemoveLock.title,
-- 
GitLab