Hook up frontend templates to render reference comments
Commit features: - renders reference comments only if their source still exists (except for old style commit refs) - allows for more complex rendering options, e.g. issue or commit status, quoted comments, etc. - properly handles updates to issue/PR titles, movement of repositories, etc. NOTE: Only the en_US locale is provided by this commit.
This commit is contained in:
parent
f25b15358c
commit
96dd2686b1
|
@ -721,7 +721,10 @@ issues.reopen_comment_issue = Comment and Reopen
|
|||
issues.create_comment = Comment
|
||||
issues.closed_at = `closed <a id="%[1]s" href="#%[1]s">%[2]s</a>`
|
||||
issues.reopened_at = `reopened <a id="%[1]s" href="#%[1]s">%[2]s</a>`
|
||||
issues.issue_ref_at = `referenced this issue from an issue <a id="%[1]s" href="#%[1]s">%[2]s</a>`
|
||||
issues.commit_ref_at = `referenced this issue from a commit <a id="%[1]s" href="#%[1]s">%[2]s</a>`
|
||||
issues.comment_ref_at = `referenced this issue from a comment <a id="%[1]s" href="#%[1]s">%[2]s</a>`
|
||||
issues.pull_ref_at = `referenced this issue from a pull request <a id="%[1]s" href="#%[1]s">%[2]s</a>`
|
||||
issues.poster = Poster
|
||||
issues.collaborator = Collaborator
|
||||
issues.owner = Owner
|
||||
|
|
|
@ -696,6 +696,10 @@ func ViewIssue(ctx *context.Context) {
|
|||
if !isAdded && !issue.IsPoster(comment.Poster.ID) {
|
||||
participants = append(participants, comment.Poster)
|
||||
}
|
||||
} else if comment.Type == models.CommentTypeIssueRef || comment.Type == models.CommentTypeCommitRef || comment.Type == models.CommentTypeCommentRef || comment.Type == models.CommentTypePullRef {
|
||||
if err = comment.LoadReference(); err != nil {
|
||||
continue
|
||||
}
|
||||
} else if comment.Type == models.CommentTypeLabel {
|
||||
if err = comment.LoadLabel(); err != nil {
|
||||
ctx.ServerError("LoadLabel", err)
|
||||
|
|
|
@ -82,7 +82,20 @@
|
|||
</a>
|
||||
<span class="text grey"><a href="{{.Poster.HomeLink}}">{{.Poster.Name}}</a> {{$.i18n.Tr "repo.issues.closed_at" .EventTag $createdStr | Safe}}</span>
|
||||
</div>
|
||||
{{else if eq .Type 4}}
|
||||
{{else if and (eq .Type 3) .RefExists}}
|
||||
<div class="event">
|
||||
<span class="octicon octicon-bookmark"></span>
|
||||
<a class="ui avatar image" href="{{.Poster.HomeLink}}">
|
||||
<img src="{{.Poster.RelAvatarLink}}">
|
||||
</a>
|
||||
<span class="text grey"><a href="{{.Poster.HomeLink}}">{{.Poster.Name}}</a> {{$.i18n.Tr "repo.issues.issue_ref_at" .EventTag $createdStr | Safe}}</span>
|
||||
|
||||
<div class="detail">
|
||||
<span class="octicon octicon-issue-opened"></span>
|
||||
<span class="text grey"><a href="{{.RefURL}}"><span class="title has-emoji">{{.RefIssue.Title | Escape}}</span> (#{{.RefIssue.Index}})</a></span>
|
||||
</div>
|
||||
</div>
|
||||
{{else if and (eq .Type 4) .RefExists}}
|
||||
<div class="event">
|
||||
<span class="octicon octicon-bookmark"></span>
|
||||
<a class="ui avatar image" href="{{.Poster.HomeLink}}">
|
||||
|
@ -92,7 +105,33 @@
|
|||
|
||||
<div class="detail">
|
||||
<span class="octicon octicon-git-commit"></span>
|
||||
<span class="text grey">{{.Content | Str2html}}</span>
|
||||
<span class="text grey"><a href="{{.RefURL}}"><span class="title has-emoji">{{.RefMessage | Escape}}</span> ({{ShortSha .CommitSHA}})</a></span>
|
||||
</div>
|
||||
</div>
|
||||
{{else if and (eq .Type 5) .RefExists}}
|
||||
<div class="event">
|
||||
<span class="octicon octicon-bookmark"></span>
|
||||
<a class="ui avatar image" href="{{.Poster.HomeLink}}">
|
||||
<img src="{{.Poster.RelAvatarLink}}">
|
||||
</a>
|
||||
<span class="text grey"><a href="{{.Poster.HomeLink}}">{{.Poster.Name}}</a> {{$.i18n.Tr "repo.issues.comment_ref_at" .EventTag $createdStr | Safe}}</span>
|
||||
|
||||
<div class="detail">
|
||||
<span class="octicon octicon-comment-discussion"></span>
|
||||
<span class="text grey"><a href="{{.RefURL}}"><span class="title has-emoji">{{.RefIssue.Title | Escape}}</span> (#{{.RefIssue.Index}})</a></span>
|
||||
</div>
|
||||
</div>
|
||||
{{else if and (eq .Type 6) .RefExists}}
|
||||
<div class="event">
|
||||
<span class="octicon octicon-bookmark"></span>
|
||||
<a class="ui avatar image" href="{{.Poster.HomeLink}}">
|
||||
<img src="{{.Poster.RelAvatarLink}}">
|
||||
</a>
|
||||
<span class="text grey"><a href="{{.Poster.HomeLink}}">{{.Poster.Name}}</a> {{$.i18n.Tr "repo.issues.pull_ref_at" .EventTag $createdStr | Safe}}</span>
|
||||
|
||||
<div class="detail">
|
||||
<span class="octicon octicon-git-pull-request"></span>
|
||||
<span class="text grey"><a href="{{.RefURL}}"><span class="title has-emoji">{{.RefIssue.Title | Escape}}</span> (#{{.RefIssue.Index}})</a></span>
|
||||
</div>
|
||||
</div>
|
||||
{{else if eq .Type 7}}
|
||||
|
|
Loading…
Reference in New Issue
Block a user