Add link to comment in code

Signed-off-by: Jonas Franz <info@jonasfranz.software>
This commit is contained in:
Jonas Franz 2018-05-31 12:07:16 +02:00 committed by Jonas Franz
parent c79e5a1f53
commit 39fcc99583
No known key found for this signature in database
GPG Key ID: 506AEEBE80BEDECD
4 changed files with 15 additions and 2 deletions

View File

@ -433,6 +433,15 @@ func (c *Comment) MustAsDiff() *Diff {
return diff
}
func (c *Comment) CodeCommentURL() string {
err := c.LoadIssue()
if err != nil { // Silently dropping errors :unamused:
log.Error(4, "LoadIssue(%d): %v", c.IssueID, err)
return ""
}
return fmt.Sprintf("%s/files#%s", c.Issue.HTMLURL(), c.HashTag())
}
func createComment(e *xorm.Session, opts *CreateCommentOptions) (_ *Comment, err error) {
var LabelID int64
if opts.Label != nil {

File diff suppressed because one or more lines are too long

View File

@ -371,7 +371,11 @@ pre, code {
}
}
.file-comment {
font: 12px Consolas,"Liberation Mono",Menlo,Courier,monospace;
color: rgba(0,0,0,.87);
}
.overflow.menu {
.items {

View File

@ -271,7 +271,7 @@
{{$.i18n.Tr "repo.issues.review.hide_outdated"}}
</button>
{{end}}
<code>{{$filename}}</code>
<a href="{{(index $comms 0).CodeCommentURL}}" class="file-comment">{{$filename}}</a>
</div>
{{$diff := ((index $comms 0).MustAsDiff)}}
{{if $diff}}