mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-03 08:55:20 +02:00
[v11.0/forgejo] fix: load OldMilestone based on OldMilestoneID, not MilestoneID (#8522)
**Manual Backport:** https://codeberg.org/forgejo/forgejo/pulls/8330 The commit which was adding tests was excluded because the tests extended the ones from #8214 (which was not backported); see https://codeberg.org/forgejo/forgejo/pulls/8330#issuecomment-5644307. Fixes #8329 Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8522 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: floss4good <floss4good@noreply.codeberg.org> Co-committed-by: floss4good <floss4good@noreply.codeberg.org>
This commit is contained in:
parent
e86730289b
commit
31323ed721
1 changed files with 8 additions and 8 deletions
|
@ -101,7 +101,7 @@ func (comments CommentList) loadMilestones(ctx context.Context) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
milestoneMaps := make(map[int64]*Milestone, len(milestoneIDs))
|
||||
milestones := make(map[int64]*Milestone, len(milestoneIDs))
|
||||
left := len(milestoneIDs)
|
||||
for left > 0 {
|
||||
limit := db.DefaultMaxInSize
|
||||
|
@ -110,7 +110,7 @@ func (comments CommentList) loadMilestones(ctx context.Context) error {
|
|||
}
|
||||
err := db.GetEngine(ctx).
|
||||
In("id", milestoneIDs[:limit]).
|
||||
Find(&milestoneMaps)
|
||||
Find(&milestones)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -118,8 +118,8 @@ func (comments CommentList) loadMilestones(ctx context.Context) error {
|
|||
milestoneIDs = milestoneIDs[limit:]
|
||||
}
|
||||
|
||||
for _, issue := range comments {
|
||||
issue.Milestone = milestoneMaps[issue.MilestoneID]
|
||||
for _, comment := range comments {
|
||||
comment.Milestone = milestones[comment.MilestoneID]
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ func (comments CommentList) loadOldMilestones(ctx context.Context) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
milestoneMaps := make(map[int64]*Milestone, len(milestoneIDs))
|
||||
milestones := make(map[int64]*Milestone, len(milestoneIDs))
|
||||
left := len(milestoneIDs)
|
||||
for left > 0 {
|
||||
limit := db.DefaultMaxInSize
|
||||
|
@ -149,7 +149,7 @@ func (comments CommentList) loadOldMilestones(ctx context.Context) error {
|
|||
}
|
||||
err := db.GetEngine(ctx).
|
||||
In("id", milestoneIDs[:limit]).
|
||||
Find(&milestoneMaps)
|
||||
Find(&milestones)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -157,8 +157,8 @@ func (comments CommentList) loadOldMilestones(ctx context.Context) error {
|
|||
milestoneIDs = milestoneIDs[limit:]
|
||||
}
|
||||
|
||||
for _, issue := range comments {
|
||||
issue.OldMilestone = milestoneMaps[issue.MilestoneID]
|
||||
for _, comment := range comments {
|
||||
comment.OldMilestone = milestones[comment.OldMilestoneID]
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue