Skip to content

Commit e504410

Browse files
fantashley6543
andauthored
Update milestone counters when issue is deleted (#21459) (#21586)
Backports #21459 When actions besides "delete" are performed on issues, the milestone counter is updated. However, since deleting issues goes through a different code path, the associated milestone's count wasn't being updated, resulting in inaccurate counts until another issue in the same milestone had a non-delete action performed on it. I verified this change fixes the inaccurate counts using a local docker build. Co-authored-by: 6543 <[email protected]>
1 parent 2ccf940 commit e504410

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

services/issue/issue.go

+5
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,11 @@ func deleteIssue(issue *issues_model.Issue) error {
224224
return err
225225
}
226226

227+
if err := issues_model.UpdateMilestoneCounters(ctx, issue.MilestoneID); err != nil {
228+
return fmt.Errorf("error updating counters for milestone id %d: %w",
229+
issue.MilestoneID, err)
230+
}
231+
227232
if err := models.DeleteIssueActions(ctx, issue.RepoID, issue.ID); err != nil {
228233
return err
229234
}

0 commit comments

Comments
 (0)