Fix showing edit buttons when the user does not have the rights to use them

This commit is contained in:
kolaente 2021-06-03 16:27:41 +02:00
parent c92062b6a5
commit 0cd9d43a7c
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
5 changed files with 15 additions and 7 deletions

View File

@ -34,11 +34,13 @@
<p class="has-text-centered has-text-grey is-italic" v-if="isPreviewActive && text === '' && emptyText !== ''">
{{ emptyText }}
<a @click="toggleEdit">Edit</a>.
<template v-if="isEditEnabled">
<a @click="toggleEdit">Edit</a>.
</template>
</p>
<ul class="actions">
<template v-if="hasEditBottom">
<template v-if="hasEditBottom && isEditEnabled">
<li>
<a v-if="!isEditActive" @click="toggleEdit">Edit</a>
<a v-else @click="toggleEdit">Done</a>

View File

@ -129,8 +129,7 @@ export default class AbstractService {
* @param route
* @returns object
*/
getRouteReplacements(route) {
let parameters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}
getRouteReplacements(route, parameters = {}) {
let replace$$1 = {}
let pattern = this.getRouteParameterPattern()
pattern = new RegExp(pattern instanceof RegExp ? pattern.source : pattern, 'g')

View File

@ -199,6 +199,10 @@
}
}
.link-share-container:not(.has-background) .task-view {
background: transparent;
}
.task-view-container {
padding-bottom: 1rem;

View File

@ -31,7 +31,7 @@
@focusout="() => saveBucketTitle(bucket.id)"
@keydown.enter.prevent.stop="() => saveBucketTitle(bucket.id)"
class="title input"
contenteditable="true"
:contenteditable="canWrite"
spellcheck="false">{{ bucket.title }}</h2>
<span
:class="{'is-max': bucket.tasks.length >= bucket.limit}"

View File

@ -509,6 +509,9 @@ export default {
this.loadTask()
},
computed: {
currentList() {
return this.$store.state[CURRENT_LIST]
},
parent() {
if (!this.task.listId) {
return {
@ -522,11 +525,11 @@ export default {
}
const list = this.$store.getters['namespaces/getListAndNamespaceById'](this.task.listId)
this.$store.commit(CURRENT_LIST, list.list)
this.$store.commit(CURRENT_LIST, list !== null ? list.list : this.currentList)
return list
},
canWrite() {
return this.task && this.task.maxRight && this.task.maxRight > rights.READ
return typeof this.task !== 'undefined' && typeof this.task.maxRight !== 'undefined' && this.task.maxRight > rights.READ
},
updatedSince() {
return this.formatDateSince(this.task.updated)