mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-22 11:42:30 +03:00
[UBER-179] Fix issue draft cleanup after switching a project (#3258)
Signed-off-by: Sergei Ogorelkov <sergei.ogorelkov@icloud.com>
This commit is contained in:
parent
73169ff987
commit
9e85271fa1
@ -99,9 +99,10 @@
|
||||
const client = getClient()
|
||||
const hierarchy = client.getHierarchy()
|
||||
const parentQuery = createQuery()
|
||||
let _space = space
|
||||
|
||||
let _space = draft?.space ?? space
|
||||
let object = draft ?? getDefaultObject(id)
|
||||
let isAssigneeTouched = false
|
||||
|
||||
function objectChange (object: IssueDraft, empty: any) {
|
||||
if (shouldSaveDraft) {
|
||||
@ -188,7 +189,7 @@
|
||||
component,
|
||||
milestone,
|
||||
priority,
|
||||
space
|
||||
space: _space
|
||||
}
|
||||
|
||||
$: if (object.space !== _space) {
|
||||
@ -278,6 +279,7 @@
|
||||
}
|
||||
|
||||
$: spaceQuery.query(tracker.class.Project, { _id: _space }, (res) => {
|
||||
resetDefaultAssigneeId()
|
||||
currentProject = res.shift()
|
||||
})
|
||||
|
||||
@ -287,8 +289,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
function resetDefaultAssigneeId () {
|
||||
if (!isAssigneeTouched && !!object.assignee && object.assignee === currentProject?.defaultAssignee) {
|
||||
object = { ...object, assignee: assignee ?? null }
|
||||
}
|
||||
}
|
||||
|
||||
function updateAssigneeId (object: IssueDraft, currentProject: Project | undefined) {
|
||||
if (object.assignee == null && currentProject !== undefined) {
|
||||
if (!isAssigneeTouched && object.assignee == null && currentProject !== undefined) {
|
||||
if (currentProject.defaultAssignee !== undefined) {
|
||||
object.assignee = currentProject.defaultAssignee
|
||||
} else {
|
||||
@ -405,6 +413,7 @@
|
||||
draftController.remove()
|
||||
resetObject()
|
||||
descriptionBox?.removeDraft(false)
|
||||
isAssigneeTouched = false
|
||||
}
|
||||
|
||||
async function setParentIssue () {
|
||||
@ -658,6 +667,7 @@
|
||||
width={'min-content'}
|
||||
short
|
||||
on:change={({ detail }) => {
|
||||
isAssigneeTouched = true
|
||||
object.assignee = detail
|
||||
manager.setFocusPos(5)
|
||||
}}
|
||||
|
Loading…
Reference in New Issue
Block a user