Merge pull request #307 from shariquerik/assignment-modal

fix: cannot unassign user
This commit is contained in:
Shariq Ansari 2024-08-14 16:38:16 +05:30 committed by GitHub
commit d6435c36e4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -9,7 +9,7 @@
label: __('Cancel'),
variant: 'subtle',
onClick: () => {
assignees = oldAssignees
assignees = [...oldAssignees]
show = false
},
},
@ -20,6 +20,11 @@
},
],
}"
@close="
() => {
assignees = [...oldAssignees]
}
"
>
<template #body-content>
<Link
@ -76,8 +81,7 @@ import UserAvatar from '@/components/UserAvatar.vue'
import Link from '@/components/Controls/Link.vue'
import { usersStore } from '@/stores/users'
import { Tooltip, call } from 'frappe-ui'
import { ref, computed } from 'vue'
import { watchOnce } from '@vueuse/core'
import { ref, computed, onMounted } from 'vue'
const props = defineProps({
doc: {
@ -106,7 +110,7 @@ const { getUser } = usersStore()
const removeValue = (value) => {
assignees.value = assignees.value.filter(
(assignee) => assignee.name !== value
(assignee) => assignee.name !== value,
)
}
@ -135,13 +139,13 @@ function updateAssignees() {
}
const removedAssignees = oldAssignees.value
.filter(
(assignee) => !assignees.value.find((a) => a.name === assignee.name)
(assignee) => !assignees.value.find((a) => a.name === assignee.name),
)
.map((assignee) => assignee.name)
const addedAssignees = assignees.value
.filter(
(assignee) => !oldAssignees.value.find((a) => a.name === assignee.name)
(assignee) => !oldAssignees.value.find((a) => a.name === assignee.name),
)
.map((assignee) => assignee.name)
@ -177,7 +181,7 @@ function updateAssignees() {
show.value = false
}
watchOnce(assignees, (value) => {
oldAssignees.value = [...value]
onMounted(() => {
oldAssignees.value = [...assignees.value]
})
</script>