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
No known key found for this signature in database
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 !== ''"> <p class="has-text-centered has-text-grey is-italic" v-if="isPreviewActive && text === '' && emptyText !== ''">
{{ emptyText }} {{ emptyText }}
<a @click="toggleEdit">Edit</a>. <template v-if="isEditEnabled">
<a @click="toggleEdit">Edit</a>.
</template>
</p> </p>
<ul class="actions"> <ul class="actions">
<template v-if="hasEditBottom"> <template v-if="hasEditBottom && isEditEnabled">
<li> <li>
<a v-if="!isEditActive" @click="toggleEdit">Edit</a> <a v-if="!isEditActive" @click="toggleEdit">Edit</a>
<a v-else @click="toggleEdit">Done</a> <a v-else @click="toggleEdit">Done</a>

View file

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

View file

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

View file

@ -509,6 +509,9 @@ export default {
this.loadTask() this.loadTask()
}, },
computed: { computed: {
currentList() {
return this.$store.state[CURRENT_LIST]
},
parent() { parent() {
if (!this.task.listId) { if (!this.task.listId) {
return { return {
@ -522,11 +525,11 @@ export default {
} }
const list = this.$store.getters['namespaces/getListAndNamespaceById'](this.task.listId) 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 return list
}, },
canWrite() { 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() { updatedSince() {
return this.formatDateSince(this.task.updated) return this.formatDateSince(this.task.updated)