Skip to content
Merged
Changes from 1 commit
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
8 changes: 8 additions & 0 deletions apps/files_sharing/src/actions/sharingStatusAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { action as sidebarAction } from '../../../files/src/actions/sidebarActio
import { generateAvatarSvg } from '../utils/AccountIcon'

import './sharingStatusAction.scss'
import { showError } from '@nextcloud/dialogs'

const isExternal = (node: Node) => {
return node.attributes?.['is-federated'] ?? false
Expand Down Expand Up @@ -118,7 +119,10 @@ export const action = new FileAction({
return true
}

// You need share permissions to share this file
// and read permissions to see the sidebar
return (node.permissions & Permission.SHARE) !== 0
&& (node.permissions & Permission.READ) !== 0
},

async exec(node: Node, view: View, dir: string) {
Expand All @@ -127,6 +131,10 @@ export const action = new FileAction({
window.OCA?.Files?.Sidebar?.setActiveTab?.('sharing')
return sidebarAction.exec(node, view, dir)
}

// Should not happen as the enabled check should prevent this
// leaving it here for safety or in case someone calls this action directly
showError(t('files_sharing', 'You do not have enough permissions to share this file.'))
return null
},

Expand Down