Skip to content
Snippets Groups Projects
Commit d8d63cfd authored by Erwan Rouchet's avatar Erwan Rouchet Committed by Bastien Abadie
Browse files

Disable annotation mode on read-only projects

parent a164233b
No related branches found
No related tags found
1 merge request!1474Disable annotation mode on read-only projects
......@@ -89,7 +89,7 @@ export default {
return this.elements[this.elementId]
},
corpusId () {
return this.element.corpus.id
return this.element?.corpus?.id
},
/**
* Disable the batch annotation form if the selected tool does not use it.
......@@ -154,8 +154,18 @@ export default {
'setBatchDeletion',
'setBatchTypeEdition',
'setDefaultType',
'setDefaultClass'
'setDefaultClass',
'toggle'
])
},
watch: {
// If we know the user's rights on the corpus, and we find that the user is not a contributor, turn annotation off
corpus: {
immediate: true,
handler (newCorpus) {
if (Array.isArray(newCorpus?.rights) && !newCorpus.rights.includes('write')) this.toggle(false)
}
}
}
}
</script>
......
......@@ -10,7 +10,7 @@
<span class="icon">
<i class="icon-plus"></i>
</span>
<span>annotate</span>
<span>Annotate</span>
</button>
<button
v-else-if="annotationEnabled"
......@@ -125,7 +125,7 @@ export default {
},
isAnnotable () {
const isFolder = this.getType(this.element.type).folder
return Boolean(this.element?.zone && !isFolder)
return this.element?.zone !== null && !isFolder && this.corpus && this.canWrite(this.corpus)
},
corpusId () {
return this.element?.corpus?.id ?? null
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment