Skip to content

Commit

Permalink
Merge pull request #8340 from owncloud/fix-custom-permission-cancel
Browse files Browse the repository at this point in the history
Fix cancelling custom permissions
  • Loading branch information
kulmann authored Jan 31, 2023
2 parents 04d0d3b + 68b2438 commit 5704e72
Show file tree
Hide file tree
Showing 4 changed files with 172 additions and 558 deletions.
6 changes: 6 additions & 0 deletions changelog/unreleased/bugfix-cancel-custom-permissions
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Cancel custom permissions

We've fixed a bug where cancelling the custom permissions on a share would remove all permissions.

https://github.com/owncloud/web/pull/8340
https://github.com/owncloud/web/issues/8335
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,14 @@
>
<oc-button
size="small"
class="files-recipient-custom-permissions-drop-cancel"
@click="cancelCustomPermissions"
v-text="$gettext('Cancel')"
/><oc-button
size="small"
variation="primary"
appearance="filled"
class="oc-ml-s"
class="files-recipient-custom-permissions-drop-confirm oc-ml-s"
@click="confirmCustomPermissions"
v-text="$gettext('Apply')"
/>
Expand All @@ -103,7 +104,6 @@
</template>

<script lang="ts">
import { mapState } from 'vuex'
import get from 'lodash-es/get'
import RoleItem from '../Shared/RoleItem.vue'
import {
Expand Down Expand Up @@ -165,8 +165,6 @@ export default defineComponent({
}
},
computed: {
...mapState('Files', ['sharesTree']),
roleButtonId() {
if (this.domSelector) {
return `files-collaborators-role-button-${this.domSelector}-${uuid.v4()}`
Expand All @@ -182,9 +180,8 @@ export default defineComponent({
} else if (this.selectedRole.permissions().includes(SharePermissions.denied)) {
return this.$gettext('Deny access')
} else {
return this.$gettextInterpolate(this.$gettext('Invite as %{ name }'), {
name: this.$gettext(this.selectedRole.inlineLabel) || ''
})
const name = this.$gettext(this.selectedRole.inlineLabel) || ''
return this.$gettext('Invite as %{ name }', { name })
}
},
customPermissionsRole() {
Expand Down Expand Up @@ -218,6 +215,9 @@ export default defineComponent({
},
resourceIsSpace() {
return this.resource.type === 'space'
},
defaultCustomPermissions() {
return [...this.selectedRole.permissions(this.allowSharePermission)]
}
},
Expand All @@ -230,7 +230,6 @@ export default defineComponent({
},
mounted() {
this.applyRoleAndPermissions()
window.addEventListener('keydown', this.cycleRoles)
},
Expand All @@ -249,11 +248,9 @@ export default defineComponent({
)[0]
}
if (this.selectedRole.hasCustomPermissions) {
this.customPermissions = this.existingPermissions
} else {
this.customPermissions = [...this.selectedRole.permissions(this.allowSharePermission)]
}
this.customPermissions = this.selectedRole.hasCustomPermissions
? this.existingPermissions
: this.defaultCustomPermissions
},
publishChange() {
Expand Down Expand Up @@ -293,7 +290,9 @@ export default defineComponent({
},
cancelCustomPermissions() {
this.customPermissions = this.existingPermissions
this.customPermissions = this.existingPermissions.length
? this.existingPermissions
: this.defaultCustomPermissions
this.$refs.customPermissionsDrop.hide()
this.$refs.rolesDrop.show()
},
Expand Down
Loading

0 comments on commit 5704e72

Please sign in to comment.