Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix set or remove expiration date on groups not possible #9513

Merged
merged 4 commits into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 remove a expiration on a group share wasn't possible.
AlexAndBear marked this conversation as resolved.
Show resolved Hide resolved

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)
Comment on lines -190 to -191
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the expiration capability is just for default expiration dates (bad naming tough)

)
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.