From 9f6f340c36ebbceeecbae948b3f229b95e593676 Mon Sep 17 00:00:00 2001 From: Paul Neubauer Date: Wed, 29 Nov 2023 00:41:31 +0100 Subject: [PATCH] Disable expiration date for alias link (#10083) * Disable expiration date for alias link * Add changelog * Remove unused input * Use elseif * Add unittests --- .../bugfix-disable-expiration-date-alias-link | 7 +++++++ .../SideBar/Shares/Links/DetailsAndEdit.vue | 2 +- .../SideBar/Shares/Links/DetailsAndEdit.spec.ts | 17 +++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 changelog/unreleased/bugfix-disable-expiration-date-alias-link diff --git a/changelog/unreleased/bugfix-disable-expiration-date-alias-link b/changelog/unreleased/bugfix-disable-expiration-date-alias-link new file mode 100644 index 00000000000..6997b2e8089 --- /dev/null +++ b/changelog/unreleased/bugfix-disable-expiration-date-alias-link @@ -0,0 +1,7 @@ +Bugfix: Disable expiration date for alias link (internal) + +We've disabled the option to set an expiration date on an internal link, +since it could be misleading and doesn't serve any use. + +https://github.com/owncloud/web/pull/10083 +https://github.com/owncloud/web/issues/9923 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 24be0e4b18a..74fc87fd8de 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 @@ -326,7 +326,7 @@ export default defineComponent({ }) } }) - } else { + } else if (!this.isAliasLink) { result.push({ id: 'add-expiration', title: this.$gettext('Set expiration date'), diff --git a/packages/web-app-files/tests/unit/components/SideBar/Shares/Links/DetailsAndEdit.spec.ts b/packages/web-app-files/tests/unit/components/SideBar/Shares/Links/DetailsAndEdit.spec.ts index 6759172ff5e..ba0bc196701 100644 --- a/packages/web-app-files/tests/unit/components/SideBar/Shares/Links/DetailsAndEdit.spec.ts +++ b/packages/web-app-files/tests/unit/components/SideBar/Shares/Links/DetailsAndEdit.spec.ts @@ -49,6 +49,23 @@ describe('DetailsAndEdit component', () => { expect(setModalInputErrorMessageStub).toHaveBeenCalledWith(expect.anything()) }) }) + + describe('editOptions computed property', () => { + it('does not add "add-expiration" option if isAliasLink is true', () => { + const exampleLinkInternal = { + name: 'Example link', + url: 'https://some-url.com/abc', + permissions: 0 + } + const { wrapper } = getShallowMountedWrapper(exampleLinkInternal, false, true) + expect(wrapper.vm.editOptions.some((option) => option.id === 'add-expiration')).toBe(false) + }) + + it('adds "add-expiration" option if isAliasLink is false', () => { + const { wrapper } = getShallowMountedWrapper(exampleLink, false, true) + expect(wrapper.vm.editOptions.some((option) => option.id === 'add-expiration')).toBe(true) + }) + }) }) function getShallowMountedWrapper(link, expireDateEnforced = false, isModifiable = false) {