mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-01-07 21:04:38 +01:00
demilestone should not include milestone (#32923)
Fix #32887 (cherry picked from commit f44712f22bc7bfce049c64c27f60453ff1e41a5c) Conflicts: services/issue/milestone_test.go trivial conflicts (require vs assert)
This commit is contained in:
parent
0efd7130f0
commit
2ffa9a5e6e
2 changed files with 12 additions and 0 deletions
|
@ -85,6 +85,10 @@ func changeMilestoneAssign(ctx context.Context, doer *user_model.User, issue *is
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if issue.MilestoneID == 0 {
|
||||||
|
issue.Milestone = nil
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ func TestChangeMilestoneAssign(t *testing.T) {
|
||||||
|
|
||||||
oldMilestoneID := issue.MilestoneID
|
oldMilestoneID := issue.MilestoneID
|
||||||
issue.MilestoneID = 2
|
issue.MilestoneID = 2
|
||||||
|
require.NoError(t, issue.LoadMilestone(db.DefaultContext))
|
||||||
require.NoError(t, ChangeMilestoneAssign(db.DefaultContext, issue, doer, oldMilestoneID))
|
require.NoError(t, ChangeMilestoneAssign(db.DefaultContext, issue, doer, oldMilestoneID))
|
||||||
unittest.AssertExistsAndLoadBean(t, &issues_model.Comment{
|
unittest.AssertExistsAndLoadBean(t, &issues_model.Comment{
|
||||||
IssueID: issue.ID,
|
IssueID: issue.ID,
|
||||||
|
@ -32,4 +33,11 @@ func TestChangeMilestoneAssign(t *testing.T) {
|
||||||
OldMilestoneID: oldMilestoneID,
|
OldMilestoneID: oldMilestoneID,
|
||||||
})
|
})
|
||||||
unittest.CheckConsistencyFor(t, &issues_model.Milestone{}, &issues_model.Issue{})
|
unittest.CheckConsistencyFor(t, &issues_model.Milestone{}, &issues_model.Issue{})
|
||||||
|
assert.NotNil(t, issue.Milestone)
|
||||||
|
|
||||||
|
oldMilestoneID = issue.MilestoneID
|
||||||
|
issue.MilestoneID = 0
|
||||||
|
require.NoError(t, ChangeMilestoneAssign(db.DefaultContext, issue, doer, oldMilestoneID))
|
||||||
|
assert.EqualValues(t, 0, issue.MilestoneID)
|
||||||
|
assert.Nil(t, issue.Milestone)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue