Skip to content

Commit f816ff8

Browse files
committed
Use locale for ghost milestone name
1 parent 2e5dee4 commit f816ff8

File tree

4 files changed

+13
-14
lines changed

4 files changed

+13
-14
lines changed

models/issue_comment.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,7 @@ func (c *Comment) LoadMilestone() error {
231231
has, err := x.ID(c.OldMilestoneID).Get(oldMilestone)
232232
if err != nil {
233233
return err
234-
} else if !has {
235-
c.OldMilestone = NewGhostMilestone()
236-
} else {
234+
} else if has {
237235
c.OldMilestone = &oldMilestone
238236
}
239237
}
@@ -243,9 +241,7 @@ func (c *Comment) LoadMilestone() error {
243241
has, err := x.ID(c.MilestoneID).Get(&milestone)
244242
if err != nil {
245243
return err
246-
} else if !has {
247-
c.Milestone = NewGhostMilestone()
248-
} else {
244+
} else if has {
249245
c.Milestone = &milestone
250246
}
251247
}

models/issue_milestone.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,6 @@ func NewMilestone(m *Milestone) (err error) {
119119
return sess.Commit()
120120
}
121121

122-
// NewGhostMilestone a fake milestone to hold the place of a deleted milestone
123-
func NewGhostMilestone() *Milestone {
124-
return &Milestone{
125-
ID: -1,
126-
Name: "Deleted",
127-
}
128-
}
129-
130122
func getMilestoneByRepoID(e Engine, repoID, id int64) (*Milestone, error) {
131123
m := &Milestone{
132124
ID: id,

options/locale/locale_en-US.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,7 @@ issues.remove_label_at = `removed the <div class="ui label" style="color: %s; ba
612612
issues.add_milestone_at = `added this to the <b>%s</b> milestone %s`
613613
issues.change_milestone_at = `modified the milestone from <b>%s</b> to <b>%s</b> %s`
614614
issues.remove_milestone_at = `removed this from the <b>%s</b> milestone %s`
615+
issues.deleted_milestone = `(deleted)`
615616
issues.self_assign_at = `self-assigned this %s`
616617
issues.add_assignee_at = `was assigned by <b>%s</b> %s`
617618
issues.remove_assignee_at = `removed their assignment %s`

routers/repo/issue.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,16 @@ func ViewIssue(ctx *context.Context) {
625625
ctx.Handle(500, "LoadMilestone", err)
626626
return
627627
}
628+
ghostMilestone := &models.Milestone{
629+
ID: -1,
630+
Name: ctx.Tr("repo.issues.deleted_milestone"),
631+
}
632+
if comment.OldMilestoneID > 0 && comment.OldMilestone == nil {
633+
comment.OldMilestone = ghostMilestone
634+
}
635+
if comment.MilestoneID > 0 && comment.Milestone == nil {
636+
comment.Milestone = ghostMilestone
637+
}
628638
} else if comment.Type == models.CommentTypeAssignees {
629639
if err = comment.LoadAssignees(); err != nil {
630640
ctx.Handle(500, "LoadAssignees", err)

0 commit comments

Comments
 (0)