Skip to content

Commit

Permalink
Merge pull request #11670 from owncloud/fix/copy-permanent-link-publi…
Browse files Browse the repository at this point in the history
…c-spaces

fix: remove copy permanent link action in public spaces
  • Loading branch information
JammingBen authored Sep 27, 2024
2 parents 3672a75 + e5b4a49 commit da7fc3a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Hide copy permanent link action on public pages

We've hidden the action for copying permanent links on public pages since it doesn't make any sense in this context.

https://github.com/owncloud/web/issues/11645
https://github.com/owncloud/web/pull/11670
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useGettext } from 'vue3-gettext'
import { FileAction } from '../types'
import { useClipboard } from '../../clipboard'
import { useMessages } from '../../piniaStores'
import { isPublicSpaceResource } from '@ownclouders/web-client'

export const useFileActionsCopyPermanentLink = () => {
const { showMessage, showErrorMessage } = useMessages()
Expand Down Expand Up @@ -32,7 +33,10 @@ export const useFileActionsCopyPermanentLink = () => {
const permalink = resource.privateLink
return copyLinkToClipboard(permalink)
},
isVisible: ({ resources }) => {
isVisible: ({ space, resources }) => {
if (isPublicSpaceResource(space)) {
return false
}
return resources.length === 1
},
class: 'oc-files-actions-copy-permanent-link-trigger'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ describe('useFileActionsCopyPermanentLink', () => {
}
})
})
it('should return false in public spaces', () => {
getWrapper({
setup: ({ actions }) => {
const publicSpace = mock<SpaceResource>({ driveType: 'public' })
expect(
unref(actions)[0].isVisible({ space: publicSpace, resources: [mock<Resource>()] })
).toBeFalsy()
}
})
})
it('should return true if one resource selected', () => {
getWrapper({
setup: ({ actions }) => {
Expand Down

0 comments on commit da7fc3a

Please sign in to comment.