From 638c2ca2d0c0386ce79c37fb5aedb2e6e4a850f0 Mon Sep 17 00:00:00 2001 From: Paul Neubauer Date: Tue, 28 Nov 2023 21:46:15 +0100 Subject: [PATCH 1/5] Disable expiration date for alias link --- .../SideBar/Shares/Links/DetailsAndEdit.vue | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) 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..36b3a0cd3aa 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 @@ -205,6 +205,7 @@ import { linkRoleInternalFolder, linkRoleUploaderFolder, LinkShareRoles, + SharePermissionBit, ShareRole } from '@ownclouders/web-client/src/helpers/share' import { computed, defineComponent, inject, PropType, Ref } from 'vue' @@ -327,13 +328,15 @@ export default defineComponent({ } }) } else { - result.push({ - id: 'add-expiration', - title: this.$gettext('Set expiration date'), - method: this.updateLink, - icon: 'calendar-event', - showDatepicker: true - }) + if (!this.isAliasLink) { + result.push({ + id: 'add-expiration', + title: this.$gettext('Set expiration date'), + method: this.updateLink, + icon: 'calendar-event', + showDatepicker: true + }) + } } if (this.link.password) { From a99ef58f925426337811fcb6ad287a7404306105 Mon Sep 17 00:00:00 2001 From: Paul Neubauer Date: Tue, 28 Nov 2023 21:48:43 +0100 Subject: [PATCH 2/5] Add changelog --- .../unreleased/bugfix-disable-expiration-date-alias-link | 7 +++++++ 1 file changed, 7 insertions(+) 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 From e5e083fca06e2e7470aa95a6b85175703042d69d Mon Sep 17 00:00:00 2001 From: Paul Neubauer Date: Tue, 28 Nov 2023 21:49:53 +0100 Subject: [PATCH 3/5] Remove unused input --- .../src/components/SideBar/Shares/Links/DetailsAndEdit.vue | 1 - 1 file changed, 1 deletion(-) 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 36b3a0cd3aa..2c0e25a8b58 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 @@ -205,7 +205,6 @@ import { linkRoleInternalFolder, linkRoleUploaderFolder, LinkShareRoles, - SharePermissionBit, ShareRole } from '@ownclouders/web-client/src/helpers/share' import { computed, defineComponent, inject, PropType, Ref } from 'vue' From 339597370bc9edf6eeb469b05f13cfe6a5de9118 Mon Sep 17 00:00:00 2001 From: Paul Neubauer Date: Tue, 28 Nov 2023 22:01:43 +0100 Subject: [PATCH 4/5] Use elseif --- .../SideBar/Shares/Links/DetailsAndEdit.vue | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) 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 2c0e25a8b58..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,16 +326,14 @@ export default defineComponent({ }) } }) - } else { - if (!this.isAliasLink) { - result.push({ - id: 'add-expiration', - title: this.$gettext('Set expiration date'), - method: this.updateLink, - icon: 'calendar-event', - showDatepicker: true - }) - } + } else if (!this.isAliasLink) { + result.push({ + id: 'add-expiration', + title: this.$gettext('Set expiration date'), + method: this.updateLink, + icon: 'calendar-event', + showDatepicker: true + }) } if (this.link.password) { From ba49444aea504b7a68ac67621b314f3b301ed0d3 Mon Sep 17 00:00:00 2001 From: Paul Neubauer Date: Tue, 28 Nov 2023 23:09:12 +0100 Subject: [PATCH 5/5] Add unittests --- .../SideBar/Shares/Links/DetailsAndEdit.spec.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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) {