Skip to content

Commit

Permalink
Disable expiration date for alias link (#10083)
Browse files Browse the repository at this point in the history
* Disable expiration date for alias link

* Add changelog

* Remove unused input

* Use elseif

* Add unittests
  • Loading branch information
lookacat authored Nov 28, 2023
1 parent df1744b commit 9f6f340
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ export default defineComponent({
})
}
})
} else {
} else if (!this.isAliasLink) {
result.push({
id: 'add-expiration',
title: this.$gettext('Set expiration date'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 9f6f340

Please sign in to comment.