Skip to content

Commit 236af19

Browse files
max-nextcloudbackportbot[bot]
authored andcommitted
fix(attachments): disable upload without owner
Signed-off-by: Max <[email protected]>
1 parent 662c9aa commit 236af19

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

src/components/Menu/ActionAttachmentUpload.vue

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
<NcActions class="entry-action entry-action__image-upload"
77
:data-text-action-entry="actionEntry.key"
88
:name="actionEntry.label"
9-
:title="actionEntry.label"
9+
:disabled="isUploadDisabled"
10+
:title="menuTitle"
1011
:aria-label="actionEntry.label"
1112
:container="menuIDSelector">
1213
<template #icon>
@@ -40,7 +41,11 @@
4041
<script>
4142
import { NcActions, NcActionButton } from '@nextcloud/vue'
4243
import { Loading, Folder, Upload } from '../icons.js'
43-
import { useIsPublicMixin, useEditorUpload } from '../Editor.provider.js'
44+
import {
45+
useIsPublicMixin,
46+
useEditorUpload,
47+
useSyncServiceMixin,
48+
} from '../Editor.provider.js'
4449
import { BaseActionEntry } from './BaseActionEntry.js'
4550
import { useMenuIDMixin } from './MenuBar.provider.js'
4651
import {
@@ -62,6 +67,7 @@ export default {
6267
mixins: [
6368
useIsPublicMixin,
6469
useEditorUpload,
70+
useSyncServiceMixin,
6571
useActionAttachmentPromptMixin,
6672
useUploadingStateMixin,
6773
useActionChooseLocalAttachmentMixin,
@@ -76,6 +82,17 @@ export default {
7682
isUploadingAttachments() {
7783
return this.$uploadingState.isUploadingAttachments
7884
},
85+
isUploadDisabled() {
86+
return !this.$syncService.hasOwner
87+
},
88+
menuTitle() {
89+
return this.isUploadDisabled
90+
? t(
91+
'text',
92+
'Attachments cannot be created or uploaded because this file is shared from another cloud.',
93+
)
94+
: this.actionEntry.label
95+
},
7996
},
8097
}
8198
</script>

0 commit comments

Comments
 (0)