Skip to content

Commit

Permalink
Merge pull request #47149 from nextcloud/fix/disable-tags-editing
Browse files Browse the repository at this point in the history
fix(files): Disable tags editing for shared files/folders with view only permission
  • Loading branch information
skjnldsv authored Aug 9, 2024
2 parents dda6dd0 + de769f0 commit 81b01c2
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 6 deletions.
1 change: 1 addition & 0 deletions apps/files/src/services/FileInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export default async function(url) {
// TODO remove when no more legacy backbone is used
fileInfo.get = (key) => fileInfo[key]
fileInfo.isDirectory = () => fileInfo.mimetype === 'httpd/unix-directory'
fileInfo.canEdit = () => Boolean(fileInfo.permissions & OC.PERMISSION_UPDATE)

return fileInfo
}
1 change: 1 addition & 0 deletions apps/files/src/views/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<div class="sidebar__description">
<SystemTags v-if="isSystemTagsEnabled && showTagsDefault"
v-show="showTags"
:disabled="!fileInfo?.canEdit()"
:file-id="fileInfo.id"
@has-tags="value => showTags = value" />
<LegacyView v-for="view in views"
Expand Down
5 changes: 5 additions & 0 deletions apps/systemtags/src/components/SystemTags.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
:options="sortedTags"
:value="selectedTags"
:create-option="createOption"
:disabled="disabled"
:taggable="true"
:passthru="true"
:fetch-tags="false"
Expand Down Expand Up @@ -65,6 +66,10 @@ export default Vue.extend({
type: Number,
required: true,
},
disabled: {
type: Boolean,
default: false,
},
},

data() {
Expand Down
4 changes: 2 additions & 2 deletions dist/core-common.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/core-common.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/files-sidebar.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files-sidebar.js.map

Large diffs are not rendered by default.

0 comments on commit 81b01c2

Please sign in to comment.