diff --git a/changelog/unreleased/enhancement-copy-quick-link-action b/changelog/unreleased/enhancement-copy-quick-link-action new file mode 100644 index 00000000000..f10485197a4 --- /dev/null +++ b/changelog/unreleased/enhancement-copy-quick-link-action @@ -0,0 +1,6 @@ +Enhancement: Copy quick link action removal + +The action for creating/copying quick links for a resource has been removed. Instead, a new action has been added to copy the permanent link of a resource. + +https://github.com/owncloud/web/pull/11553 +https://github.com/owncloud/web/issues/11544 diff --git a/changelog/unreleased/enhancement-internal-link-removal b/changelog/unreleased/enhancement-internal-link-removal new file mode 100644 index 00000000000..9d30e255e4c --- /dev/null +++ b/changelog/unreleased/enhancement-internal-link-removal @@ -0,0 +1,6 @@ +Enhancement: Internal link removal + +The internal link type has been removed because the permanent link makes it obsolete. Existing internal links still resolve correctly to ensure backwards compatibility. + +https://github.com/owncloud/web/pull/11553 +https://github.com/owncloud/web/issues/11544 diff --git a/packages/web-app-files/src/components/SideBar/Shares/FileLinks.vue b/packages/web-app-files/src/components/SideBar/Shares/FileLinks.vue index 5858f3d6992..e7dbcc6bde3 100644 --- a/packages/web-app-files/src/components/SideBar/Shares/FileLinks.vue +++ b/packages/web-app-files/src/components/SideBar/Shares/FileLinks.vue @@ -5,17 +5,14 @@

-

+
- +
{ + if (!ability.can('create-all', 'PublicLink')) { + return false + } + return canShare({ space: unref(space), resource: unref(resource) }) + }) const sharesStore = useSharesStore() const { updateLink, deleteLink } = sharesStore @@ -182,7 +186,7 @@ export default defineComponent({ const canEditLink = (linkShare: LinkShare) => { return ( - canCreateLinks({ space: unref(space), resource: unref(resource) }) && + unref(canCreateLinks) && (can('create-all', 'PublicLink') || linkShare.type === SharingLinkType.Internal) ) } diff --git a/packages/web-app-files/src/components/SideBar/Shares/Links/DetailsAndEdit.vue b/packages/web-app-files/src/components/SideBar/Shares/Links/DetailsAndEdit.vue index ff6267ad783..97458a48a5a 100644 --- a/packages/web-app-files/src/components/SideBar/Shares/Links/DetailsAndEdit.vue +++ b/packages/web-app-files/src/components/SideBar/Shares/Links/DetailsAndEdit.vue @@ -149,7 +149,6 @@ import { OcDrop } from 'design-system/src/components' import { usePasswordPolicyService } from '@ownclouders/web-pkg' import { useGettext } from 'vue3-gettext' import SetLinkPasswordModal from '../../../Modals/SetLinkPasswordModal.vue' -import { storeToRefs } from 'pinia' import { SharingLinkType } from '@ownclouders/web-client/graph/generated' import DatePickerModal from '../../../Modals/DatePickerModal.vue' import ExpirationDateIndicator from '../ExpirationDateIndicator.vue' @@ -204,7 +203,6 @@ export default defineComponent({ useLinkTypes() const resourcesStore = useResourcesStore() - const { ancestorMetaData } = storeToRefs(resourcesStore) const space = inject>('space') const resource = inject>('resource') diff --git a/packages/web-app-files/src/composables/extensions/useFileActions.ts b/packages/web-app-files/src/composables/extensions/useFileActions.ts index d5c2946c798..29f5867cf94 100644 --- a/packages/web-app-files/src/composables/extensions/useFileActions.ts +++ b/packages/web-app-files/src/composables/extensions/useFileActions.ts @@ -1,6 +1,6 @@ import { ActionExtension, - useFileActionsCopyQuickLink, + useFileActionsCopyPermanentLink, useFileActionsOpenShortcut, useFileActionsShowShares } from '@ownclouders/web-pkg' @@ -14,7 +14,7 @@ import { unref } from 'vue' export const useFileActions = (): ActionExtension[] => { const { actions: openShortcutActions } = useFileActionsOpenShortcut() const { actions: showSharesActions } = useFileActionsShowShares() - const { actions: quickLinkActions } = useFileActionsCopyQuickLink() + const { actions: permanentLinkActions } = useFileActionsCopyPermanentLink() return [ { @@ -33,7 +33,7 @@ export const useFileActions = (): ActionExtension[] => { id: 'com.github.owncloud.web.files.quick-action.quicklink', extensionPointIds: [quickActionsExtensionPoint.id], type: 'action', - action: unref(quickLinkActions)[0] + action: unref(permanentLinkActions)[0] } ] } diff --git a/packages/web-app-files/tests/unit/components/FilesList/QuickActions.spec.ts b/packages/web-app-files/tests/unit/components/FilesList/QuickActions.spec.ts index ff122712f82..ea52f50bac0 100644 --- a/packages/web-app-files/tests/unit/components/FilesList/QuickActions.spec.ts +++ b/packages/web-app-files/tests/unit/components/FilesList/QuickActions.spec.ts @@ -21,13 +21,13 @@ const collaboratorAction = { label: () => 'Add people' } -const quickLinkAction = { +const permanentLinkAction = { isVisible: vi.fn(() => false), handler: vi.fn(), icon: 'link-add', - id: 'quicklink', - name: 'copy-quicklink', - label: () => 'Create and copy quicklink' + id: 'permanent-link', + name: 'copy-permanent-link', + label: () => 'Copy permanent link' } const testItem = { @@ -58,7 +58,7 @@ describe('QuickActions', () => { }) it('should not display action buttons where "displayed" is set to false', () => { - const linkActionButton = wrapper.find('.files-quick-action-copy-quicklink') + const linkActionButton = wrapper.find('.files-quick-action-copy-permanent-link') expect(linkActionButton.exists()).toBeFalsy() }) @@ -96,7 +96,7 @@ function getWrapper({ embedModeEnabled = false } = {}) { }), mock({ extensionPointIds: [quickActionsExtensionPoint.id], - action: quickLinkAction + action: permanentLinkAction }) ]) diff --git a/packages/web-app-files/tests/unit/components/SideBar/Shares/FileLinks.spec.ts b/packages/web-app-files/tests/unit/components/SideBar/Shares/FileLinks.spec.ts index c7c04f63f93..052546a9e52 100644 --- a/packages/web-app-files/tests/unit/components/SideBar/Shares/FileLinks.spec.ts +++ b/packages/web-app-files/tests/unit/components/SideBar/Shares/FileLinks.spec.ts @@ -108,7 +108,7 @@ describe('FileLinks', () => { describe('when the add-new-link button is clicked', () => { it('should call createLink', async () => { - const { wrapper, mocks } = getWrapper({ abilities: [] }) + const { wrapper, mocks } = getWrapper() await wrapper.find(selectors.linkAddButton).trigger('click') expect(mocks.createLinkMock).toHaveBeenCalledTimes(1) }) @@ -129,7 +129,7 @@ describe('FileLinks', () => { canShare: () => true }) - it('existing viewer link is not modifiable', () => { + it('existing link is not modifiable', () => { const viewerLink = defaultLinksList[0] viewerLink.type = SharingLinkType.View const { wrapper } = getWrapper({ resource, abilities: [], links: [viewerLink] }) @@ -139,15 +139,9 @@ describe('FileLinks', () => { const isModifiable = detailsAndEdit.props('isModifiable') expect(isModifiable).toBeFalsy() }) - it('existing internal link is modifiable', () => { - const internalLink = defaultLinksList[0] - internalLink.type = SharingLinkType.Internal - const { wrapper } = getWrapper({ resource, abilities: [], links: [internalLink] }) - const detailsAndEdit = wrapper.findComponent( - linkListItemDetailsAndEdit - ) - const isModifiable = detailsAndEdit.props('isModifiable') - expect(isModifiable).toBeTruthy() + it('new links cannot be created', () => { + const { wrapper } = getWrapper({ resource, abilities: [] }) + expect(wrapper.find(selectors.linkAddButton).exists()).toBeFalsy() }) }) }) diff --git a/packages/web-pkg/src/components/AppTemplates/AppWrapper.vue b/packages/web-pkg/src/components/AppTemplates/AppWrapper.vue index e593cb8ba32..0894648664a 100644 --- a/packages/web-pkg/src/components/AppTemplates/AppWrapper.vue +++ b/packages/web-pkg/src/components/AppTemplates/AppWrapper.vue @@ -61,7 +61,7 @@ import { useConfigStore, useResourcesStore, FileContentOptions, - useFileActionsCopyQuickLink, + useFileActionsCopyPermanentLink, useFileActionsDownloadFile, useFileActionsShowDetails, useFileActionsShowShares, @@ -141,7 +141,7 @@ export default defineComponent({ const { actions: openWithAppActions } = useFileActionsOpenWithApp({ appId: props.applicationId }) - const { actions: createQuickLinkActions } = useFileActionsCopyQuickLink() + const { actions: copyPermanentLinkActions } = useFileActionsCopyPermanentLink() const { actions: downloadFileActions } = useFileActionsDownloadFile() const { actions: showDetailsActions } = useFileActionsShowDetails() const { actions: showSharesActions } = useFileActionsShowShares() @@ -484,7 +484,7 @@ export default defineComponent({ ) }) const menuItemsShare = computed(() => { - return [...unref(showSharesActions), ...unref(createQuickLinkActions)].filter((item) => + return [...unref(showSharesActions), ...unref(copyPermanentLinkActions)].filter((item) => item.isVisible(unref(actionOptions)) ) }) diff --git a/packages/web-pkg/src/components/CreateLinkModal.vue b/packages/web-pkg/src/components/CreateLinkModal.vue index 6a0b48ab7d3..0c2ed7031d7 100644 --- a/packages/web-pkg/src/components/CreateLinkModal.vue +++ b/packages/web-pkg/src/components/CreateLinkModal.vue @@ -24,23 +24,17 @@
-