Skip to content

Commit

Permalink
UBER-550: clean milestone when moving to another project (#3498)
Browse files Browse the repository at this point in the history
Signed-off-by: Vyacheslav Tumanov <me@slavatumanov.me>
  • Loading branch information
ThetaDR authored and annano committed Aug 24, 2023
1 parent af40892 commit eef6687
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion plugins/tracker-resources/src/components/issues/Move.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import { Ref, Status } from '@hcengineering/core'
import { SpaceSelector, createQuery, getClient } from '@hcengineering/presentation'
import { Component, Issue, IssueStatus, Project } from '@hcengineering/tracker'
import { Component, Issue, IssueStatus, Milestone, Project } from '@hcengineering/tracker'
import ui, { Button, IconClose, Label, Spinner, Toggle, tooltip } from '@hcengineering/ui'
import view from '@hcengineering/view'
import { statusStore } from '@hcengineering/view-resources'
Expand Down Expand Up @@ -170,6 +170,12 @@
components = res
})
const milestoneQuery = createQuery()
let milestones: Milestone[] = []
$: milestoneQuery.query(tracker.class.Milestone, {}, (res) => {
milestones = res
})
$: statuses = $statusStore.filter((it) => it.space === currentSpace?._id)
let keepOriginalAttribytes: boolean = false
Expand Down Expand Up @@ -238,6 +244,18 @@
}
}
}
if (issue.milestone != null) {
const currentMilestone = milestones.find((it) => it._id === issue.milestone)
if (currentMilestone !== undefined) {
if (upd.milestone === undefined) {
upd.milestone = milestones.find(
(it) => it.space === currentSpace?._id && it.label === currentMilestone.label
)?._id
}
}
}
if (issue.attachedTo !== tracker.ids.NoParent && toMove.find((it) => it._id === issue.attachedTo) === undefined) {
upd.attachedTo = tracker.ids.NoParent
upd.attachedToClass = tracker.class.Issue
Expand Down

0 comments on commit eef6687

Please sign in to comment.