TSK-1206: drag-drop statuses between categories (#3112)

Signed-off-by: Vyacheslav Tumanov <me@slavatumanov.me>
This commit is contained in:
Vyacheslav Tumanov 2023-04-28 18:05:17 +05:00 committed by GitHub
parent c4ff71fe50
commit 77bd4fea29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -179,16 +179,12 @@
} }
function handleDragOver (ev: DragEvent, status: IssueStatus) { function handleDragOver (ev: DragEvent, status: IssueStatus) {
if (draggingStatus?.category === status.category) { hoveringStatus = status
hoveringStatus = status ev.preventDefault()
ev.preventDefault()
} else {
hoveringStatus = null
}
} }
async function handleDrop (toItem: IssueStatus) { async function handleDrop (toItem: IssueStatus) {
if (draggingStatus != null && draggingStatus?._id !== toItem._id && draggingStatus?.category === toItem.category) { if (draggingStatus != null && draggingStatus?._id !== toItem._id) {
const fromIndex = getStatusIndex(draggingStatus) const fromIndex = getStatusIndex(draggingStatus)
const toIndex = getStatusIndex(toItem) const toIndex = getStatusIndex(toItem)
const [prev, next] = [ const [prev, next] = [
@ -197,7 +193,9 @@
] ]
isSaving = true isSaving = true
await client.update(draggingStatus, { rank: calcRank(prev, next) }) let newCategory = {}
if (draggingStatus?.category !== toItem.category) newCategory = { category: toItem.category }
await client.update(draggingStatus, { rank: calcRank(prev, next), ...newCategory })
isSaving = false isSaving = false
} }