Fix Assignees being deleted when adding a due date (#254)
continuous-integration/drone/push Build is passing Details

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

View File

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