Prevent editing read-only tasks in list view

Signed-off-by: Raimund Schlüßler <raimund.schluessler@mailbox.org>
This commit is contained in:
Raimund Schlüßler 2019-07-21 22:11:41 +02:00
parent b4e175daf3
commit b1393b7e32
No known key found for this signature in database
GPG key ID: 036FA7EB1A599178
3 changed files with 14 additions and 2 deletions

View file

@ -1153,6 +1153,10 @@
}
}
&.disabled {
cursor: not-allowed;
}
&.active {
opacity: .7;
}

View file

@ -47,11 +47,11 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
role="checkbox"
@click="toggleCompleted(task)"
>
<span :class="{'icon-checkmark': task.completed}" class="icon icon-bw task-checkbox reactive no-nav" />
<span :class="{'icon-checkmark': task.completed, 'disabled': task.calendar.readOnly}" class="icon icon-bw task-checkbox reactive no-nav" />
</span>
<span class="icon task-separator" />
<span class="task-star" @click="toggleStarred(task)">
<span :class="[iconStar]" class="icon right large reactive no-nav" />
<span :class="[iconStar, {'disabled': task.calendar.readOnly}]" class="icon right large reactive no-nav" />
</span>
<span v-if="!task.calendar.readOnly"
class="task-addsubtask add-subtask"

View file

@ -727,6 +727,10 @@ const actions = {
* @param {Task} task The task to update
*/
async toggleCompleted(context, task) {
// Don't try to edit tasks in read-only calendars
if (task.calendar.readOnly) {
return
}
if (task.completed) {
await context.dispatch('setPercentComplete', { task: task, complete: 0 })
} else {
@ -788,6 +792,10 @@ const actions = {
* @param {Task} task The task to update
*/
async toggleStarred(context, task) {
// Don't try to edit tasks in read-only calendars
if (task.calendar.readOnly) {
return
}
context.commit('toggleStarred', task)
context.dispatch('scheduleTaskUpdate', task)
},