Fix deleted milestone bug (#1942)
* Fix deleted milestone bug * Use locale for ghost milestone name * Fix pointer bug
This commit is contained in:
parent
ce9b86082c
commit
8fc64741d9
@ -231,26 +231,20 @@ func (c *Comment) LoadMilestone() error {
|
|||||||
has, err := x.ID(c.OldMilestoneID).Get(&oldMilestone)
|
has, err := x.ID(c.OldMilestoneID).Get(&oldMilestone)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
} else if !has {
|
} else if has {
|
||||||
return ErrMilestoneNotExist{
|
|
||||||
ID: c.OldMilestoneID,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
c.OldMilestone = &oldMilestone
|
c.OldMilestone = &oldMilestone
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if c.MilestoneID > 0 {
|
if c.MilestoneID > 0 {
|
||||||
var milestone Milestone
|
var milestone Milestone
|
||||||
has, err := x.ID(c.MilestoneID).Get(&milestone)
|
has, err := x.ID(c.MilestoneID).Get(&milestone)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
} else if !has {
|
} else if has {
|
||||||
return ErrMilestoneNotExist{
|
|
||||||
ID: c.MilestoneID,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
c.Milestone = &milestone
|
c.Milestone = &milestone
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -612,6 +612,7 @@ issues.remove_label_at = `removed the <div class="ui label" style="color: %s; ba
|
|||||||
issues.add_milestone_at = `added this to the <b>%s</b> milestone %s`
|
issues.add_milestone_at = `added this to the <b>%s</b> milestone %s`
|
||||||
issues.change_milestone_at = `modified the milestone from <b>%s</b> to <b>%s</b> %s`
|
issues.change_milestone_at = `modified the milestone from <b>%s</b> to <b>%s</b> %s`
|
||||||
issues.remove_milestone_at = `removed this from the <b>%s</b> milestone %s`
|
issues.remove_milestone_at = `removed this from the <b>%s</b> milestone %s`
|
||||||
|
issues.deleted_milestone = `(deleted)`
|
||||||
issues.self_assign_at = `self-assigned this %s`
|
issues.self_assign_at = `self-assigned this %s`
|
||||||
issues.add_assignee_at = `was assigned by <b>%s</b> %s`
|
issues.add_assignee_at = `was assigned by <b>%s</b> %s`
|
||||||
issues.remove_assignee_at = `removed their assignment %s`
|
issues.remove_assignee_at = `removed their assignment %s`
|
||||||
|
@ -625,6 +625,16 @@ func ViewIssue(ctx *context.Context) {
|
|||||||
ctx.Handle(500, "LoadMilestone", err)
|
ctx.Handle(500, "LoadMilestone", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
ghostMilestone := &models.Milestone{
|
||||||
|
ID: -1,
|
||||||
|
Name: ctx.Tr("repo.issues.deleted_milestone"),
|
||||||
|
}
|
||||||
|
if comment.OldMilestoneID > 0 && comment.OldMilestone == nil {
|
||||||
|
comment.OldMilestone = ghostMilestone
|
||||||
|
}
|
||||||
|
if comment.MilestoneID > 0 && comment.Milestone == nil {
|
||||||
|
comment.Milestone = ghostMilestone
|
||||||
|
}
|
||||||
} else if comment.Type == models.CommentTypeAssignees {
|
} else if comment.Type == models.CommentTypeAssignees {
|
||||||
if err = comment.LoadAssignees(); err != nil {
|
if err = comment.LoadAssignees(); err != nil {
|
||||||
ctx.Handle(500, "LoadAssignees", err)
|
ctx.Handle(500, "LoadAssignees", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user