Fix Assignees being deleted when adding a due date (#254)

Use a model to make sure all changes of task assignees are bubbled back up to the task

Co-authored-by: kolaente <k@knt.li>
Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/254
Co-Authored-By: konrad <konrad@kola-entertainments.de>
Co-Committed-By: konrad <konrad@kola-entertainments.de>
This commit is contained in:
konrad 2020-10-02 16:40:04 +00:00
parent f5f901181c
commit 4defe4c28a
2 changed files with 9 additions and 7 deletions

View file

@ -65,13 +65,12 @@ export default {
type: Number,
required: true,
},
initialAssignees: {
type: Array,
default: () => [],
},
disabled: {
default: false,
},
value: {
type: Array,
},
},
data() {
return {
@ -83,19 +82,22 @@ export default {
}
},
created() {
this.assignees = this.initialAssignees
this.assignees = this.value
this.listUserService = new ListUserService()
this.newAssignee = new UserModel()
this.taskAssigneeService = new TaskAssigneeService()
},
watch: {
initialAssignees(newVal) {
value(newVal) {
this.assignees = newVal
},
},
methods: {
addAssignee(user) {
this.$store.dispatch('tasks/addAssignee', {user: user, taskId: this.taskId})
.then(() => {
this.$emit('input', this.assignees)
})
.catch(e => {
this.error(e, this)
})

View file

@ -32,10 +32,10 @@
</div>
<edit-assignees
:disabled="!canWrite"
:initial-assignees="task.assignees"
:list-id="task.listId"
:task-id="task.id"
ref="assignees"
v-model="task.assignees"
/>
</div>
<div class="column" v-if="activeFields.priority">