Browse Source

issue问题修改。

Signed-off-by: zouap <zouap@pcl.ac.cn>
tags/v1.22.12.2^2
zouap 3 years ago
parent
commit
6d4a039df9
3 changed files with 29 additions and 2 deletions
  1. +19
    -0
      models/issue_list.go
  2. +5
    -1
      routers/repo/issue.go
  3. +5
    -1
      templates/repo/issue/list.tmpl

+ 19
- 0
models/issue_list.go View File

@@ -511,6 +511,25 @@ func (issues IssueList) LoadComments() error {
return issues.loadComments(x, builder.NewCond())
}

// LoadClosedComments loads discuss comments
func (issues IssueList) LoadClosedComments() error {
err := issues.loadComments(x, builder.Eq{"comment.type": CommentTypeClose})
if err == nil {
for _, issue := range issues {
if issue.Comments != nil {
tmp := make([]*Comment, 0)
tmp = append(tmp, issue.Comments[len(issue.Comments)-1])
issue.Comments = tmp
for i, comm := range issue.Comments {
fmt.Printf("comm load poster.i=" + fmt.Sprint(i))
comm.LoadPoster()
}
}
}
}
return err
}

// LoadDiscussComments loads discuss comments
func (issues IssueList) LoadDiscussComments() error {
return issues.loadComments(x, builder.Eq{"comment.type": CommentTypeComment})


+ 5
- 1
routers/repo/issue.go View File

@@ -224,7 +224,11 @@ func issues(ctx *context.Context, milestoneID int64, isPullOption util.OptionalB
}
}

approvalCounts, err := models.IssueList(issues).GetApprovalCounts()
issueList := models.IssueList(issues)
if isShowClosed {
issueList.LoadClosedComments()
}
approvalCounts, err := issueList.GetApprovalCounts()
if err != nil {
ctx.ServerError("ApprovalCounts", err)
return


+ 5
- 1
templates/repo/issue/list.tmpl View File

@@ -270,7 +270,11 @@
{{if .OriginalAuthor }}
{{$.i18n.Tr .GetLastEventLabelFake $timeStr .OriginalAuthor | Safe}}
{{else if gt .Poster.ID 0}}
{{$.i18n.Tr .GetLastEventLabel $timeStr .Poster.HomeLink (.Poster.GetDisplayName | Escape) | Safe}}
{{if .IsClosed}}
{{$.i18n.Tr .GetLastEventLabelFake $timeStr .Poster.HomeLink (.Poster.GetDisplayName | Escape) | Safe}}
{{eles}}
{{$.i18n.Tr .GetLastEventLabel $timeStr .Poster.HomeLink (.Poster.GetDisplayName | Escape) | Safe}}
{{end}}
{{else}}
{{$.i18n.Tr .GetLastEventLabelFake $timeStr (.Poster.GetDisplayName | Escape) | Safe}}
{{end}}


Loading…
Cancel
Save