Fix: add comment icon is only shown on code lines
This commit is contained in:
parent
a0d9afd0da
commit
b2092fe2f8
|
@ -67,6 +67,10 @@ func (d *DiffLine) GetType() int {
|
|||
return int(d.Type)
|
||||
}
|
||||
|
||||
func (d *DiffLine) CanComment() bool {
|
||||
return len(d.Comments) == 0 && d.Type != DiffLineSection
|
||||
}
|
||||
|
||||
// GetCommentSide returns the comment side of the first comment, if not set returns empty string
|
||||
func (d *DiffLine) GetCommentSide() string {
|
||||
if len(d.Comments) == 0 {
|
||||
|
|
|
@ -106,7 +106,7 @@
|
|||
|
||||
</td>
|
||||
<td class="lines-code lines-code-old halfwidth">
|
||||
{{if and $.SignedUserID (not (len $line.Comments))}}
|
||||
{{if and $.root.SignedUserID $line.CanComment}}
|
||||
<a class="ui green button add-code-comment add-code-comment-left" data-path="{{$file.Name}}" data-side="left" data-idx="{{$line.LeftIdx}}">+</a>
|
||||
{{end}}
|
||||
<pre><code class="wrap {{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{if $line.LeftIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</code></pre>
|
||||
|
@ -116,7 +116,7 @@
|
|||
</td>
|
||||
|
||||
<td class="lines-code lines-code-new halfwidth">
|
||||
{{if and $.SignedUserID (not (len $line.Comments))}}
|
||||
{{if and $.root.SignedUserID $line.CanComment}}
|
||||
<a class="ui green button add-code-comment add-code-comment-right" data-path="{{$file.Name}}" data-side="right" data-idx="{{$line.RightIdx}}">+</a>
|
||||
{{end}}
|
||||
<pre><code class="wrap {{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{if $line.RightIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</code></pre>
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
</td>
|
||||
{{end}}
|
||||
<td class="lines-code {{if (not $line.RightIdx)}}lines-code-old{{end}}">
|
||||
{{if and $.root.SignedUserID (not (len $line.Comments))}}
|
||||
{{if and $.root.SignedUserID $line.CanComment}}
|
||||
<a class="ui green button add-code-comment add-code-comment-{{if $line.RightIdx}}right{{else}}left{{end}}" data-path="{{$file.Name}}" data-side="{{if $line.RightIdx}}right{{else}}left{{end}}" data-idx="{{if $line.RightIdx}}{{$line.RightIdx}}{{else}}{{$line.LeftIdx}}{{end}}">+</a>
|
||||
{{end}}
|
||||
<pre><code class="wrap {{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{$section.GetComputedInlineDiffFor $line}}</code></pre>
|
||||
|
|
Loading…
Reference in New Issue
Block a user