Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove copy permanent link action in public spaces #11670

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
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