Skip to content

Commit

Permalink
Fix set or remove expiration date on groups not possible (#9513)
Browse files Browse the repository at this point in the history
* Fix set or remove expiration date on groups not possible

* Add changelog item

* Rm unused snapshot
  • Loading branch information
Jan authored Aug 3, 2023
1 parent 56e5098 commit eb25832
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Set or remove expiration date on group share not possible

We've fixed a bug where setting or removing an expiration on a group share wasn't possible.

https://github.com/owncloud/web/pull/9513
https://github.com/owncloud/web/issues/8419
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@
@click="togglePopover"
>
<oc-icon name="calendar-event" fill-type="line" size="medium" variation="passive" />
<span v-if="isExpirationDateSet" v-text="$gettext('Edit expiration date')" />
<span
class="oc-ml-s"
v-if="isExpirationDateSet"
v-text="$gettext('Edit expiration date')"
/>
<span v-else v-text="$gettext('Set expiration date')" />
</oc-button>
</template>
Expand Down Expand Up @@ -186,10 +190,7 @@ export default defineComponent({
},
isExpirationSupported() {
return (
(this.editingUser && this.userExpirationDate) ||
(this.editingGroup && this.groupExpirationDate)
)
return this.editingUser || this.editingGroup
},
isExpirationDateSet() {
Expand Down Expand Up @@ -248,14 +249,14 @@ export default defineComponent({
isExpirationDateEnforced() {
if (this.editingUser) {
return this.userExpirationDate.enforced
return this.userExpirationDate?.enforced
}
if (this.editingGroup) {
return this.groupExpirationDate.enforced
return this.groupExpirationDate?.enforced
}
return this.userExpirationDate.enforced || this.groupExpirationDate.enforced
return this.userExpirationDate?.enforced || this.groupExpirationDate?.enforced
},
maxExpirationDate() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div v-if="available" class="oc-flex oc-flex-middle oc-flex-nowrap">
<div class="oc-flex oc-flex-middle oc-flex-nowrap">
<oc-datepicker
v-model="dateCurrent"
:min-date="dateMin"
Expand Down Expand Up @@ -72,7 +72,6 @@ export default defineComponent({
const capabilities = computed(() => store.getters.capabilities)
const optionsUser = computed(() => capabilities.value.files_sharing.user?.expire_date)
const optionsGroup = computed(() => capabilities.value.files_sharing.group?.expire_date)
const available = computed(() => optionsUser.value || optionsGroup.value)
const enforced = computed(() => optionsUser.value?.enforced || optionsGroup.value?.enforced)
const dateMin = DateTime.now().setLocale(language.current).toJSDate()
const dateDefault = computed(() => {
Expand Down Expand Up @@ -151,7 +150,6 @@ export default defineComponent({
return {
language,
enforced,
available,
dateCurrent,
dateMin,
dateMax,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ const enforcedCapabilities = merge({}, enabledCapabilities, {
})

describe('InviteCollaborator ExpirationDatepicker', () => {
it('only gets displayed if share expiration is supported', () => {
const { wrapper } = createWrapper()
expect(wrapper.html()).toMatchSnapshot()
})

it('renders a button to open the datepicker and set an expiration date', () => {
const { wrapper } = createWrapper({ capabilities: bareCapabilities })
expect(wrapper.find('[data-testid="recipient-datepicker-btn"]').exists()).toBe(true)
Expand Down

This file was deleted.

0 comments on commit eb25832

Please sign in to comment.