Browse Source

提交issue关闭错误问题

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

+ 21
- 0
models/issue.go View File

@@ -839,6 +839,27 @@ func (issue *Issue) GetLastEventLabel() string {
return "repo.issues.opened_by"
}

// GetLastComment return last comment for the current issue.
func (issue *Issue) GetCloseUser() (*User, error) {
var c Comment
exist, err := x.Where("type = ?", CommentTypeClose).
And("issue_id = ?", issue.ID).Desc("id").Get(&c)
if err != nil {
return nil, err
}
if !exist {
return nil, nil
}
err = c.LoadPoster()
if err == nil {
return c.Poster, nil
}
if issue.Poster == nil {
issue.LoadPoster()
}
return issue.Poster, nil
}

// GetLastComment return last comment for the current issue.
func (issue *Issue) GetLastComment() (*Comment, error) {
var c Comment


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

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

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


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

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


Loading…
Cancel
Save