Skip to content

Commit 4445909

Browse files
committed
fix comment rendering
Signed-off-by: Andrew Thornton <[email protected]>
1 parent 8f63005 commit 4445909

File tree

1 file changed

+37
-24
lines changed

1 file changed

+37
-24
lines changed

templates/repo/diff/section_split.tmpl

Lines changed: 37 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -40,44 +40,57 @@
4040
<td class="lines-code lines-code-new halfwidth">{{if and $.root.SignedUserID $.root.PageIsPullFiles (not (eq .GetType 3))}}<a class="ui primary button add-code-comment add-code-comment-right{{if (not $line.CanComment)}} invisible{{end}}" data-path="{{$file.Name}}" data-side="right" data-idx="{{$line.RightIdx}}" data-new-comment-url="{{$.root.Issue.HTMLURL}}/files/reviews/new_comment">{{svg "octicon-plus"}}</a>{{end}}<code class="code-inner">{{if $line.RightIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</code></td>
4141
{{end}}
4242
</tr>
43-
{{if gt (len $line.Comments) 0}}
44-
<tr class="add-comment" data-line-type="{{DiffLineTypeToStr .GetType}}">
45-
<td class="lines-num"></td>
46-
<td class="lines-type-marker"></td>
47-
<td class="add-comment-left">
48-
{{if eq $line.GetCommentSide "previous"}}
49-
{{template "repo/diff/conversation" mergeinto $.root "comments" $line.Comments}}
50-
{{end}}
51-
</td>
52-
<td class="lines-num"></td>
53-
<td class="lines-type-marker"></td>
54-
<td class="add-comment-right">
55-
{{if eq $line.GetCommentSide "proposed"}}
56-
{{template "repo/diff/conversation" mergeinto $.root "comments" $line.Comments}}
57-
{{end}}
58-
</td>
59-
</tr>
60-
{{end}}
6143
{{if and (eq .GetType 3) $hasmatch}}
6244
{{$match := index $section.Lines $line.Match}}
63-
{{if gt (len $match.Comments) 0}}
64-
<tr class="add-comment" data-line-type="add">
45+
{{if or (gt (len $line.Comments) 0) (gt (len $match.Comments) 0)}}
46+
<tr class="add-comment" data-line-type="{{DiffLineTypeToStr .GetType}}">
6547
<td class="lines-num"></td>
6648
<td class="lines-type-marker"></td>
6749
<td class="add-comment-left">
68-
{{if eq $match.GetCommentSide "previous"}}
69-
{{template "repo/diff/conversation" mergeinto $.root "comments" $match.Comments}}
50+
{{if gt (len $line.Comments) 0}}
51+
{{if eq $line.GetCommentSide "previous"}}
52+
{{template "repo/diff/conversation" mergeinto $.root "comments" $line.Comments}}
53+
{{end}}
54+
{{end}}
55+
{{if gt (len $match.Comments) 0}}
56+
{{if eq $match.GetCommentSide "previous"}}
57+
{{template "repo/diff/conversation" mergeinto $.root "comments" $match.Comments}}
58+
{{end}}
7059
{{end}}
7160
</td>
7261
<td class="lines-num"></td>
7362
<td class="lines-type-marker"></td>
7463
<td class="add-comment-right">
75-
{{if eq $match.GetCommentSide "proposed"}}
76-
{{template "repo/diff/conversation" mergeinto $.root "comments" $match.Comments}}
64+
{{if eq $line.GetCommentSide "proposed"}}
65+
{{template "repo/diff/conversation" mergeinto $.root "comments" $line.Comments}}
66+
{{end}}
67+
{{if gt (len $match.Comments) 0}}
68+
{{if eq $match.GetCommentSide "proposed"}}
69+
{{template "repo/diff/conversation" mergeinto $.root "comments" $match.Comments}}
70+
{{end}}
7771
{{end}}
7872
</td>
7973
</tr>
8074
{{end}}
75+
{{else if gt (len $line.Comments) 0}}
76+
<tr class="add-comment" data-line-type="{{DiffLineTypeToStr .GetType}}">
77+
<td class="lines-num"></td>
78+
<td class="lines-type-marker"></td>
79+
<td class="add-comment-left">
80+
{{if gt (len $line.Comments) 0}}
81+
{{if eq $line.GetCommentSide "previous"}}
82+
{{template "repo/diff/conversation" mergeinto $.root "comments" $line.Comments}}
83+
{{end}}
84+
{{end}}
85+
</td>
86+
<td class="lines-num"></td>
87+
<td class="lines-type-marker"></td>
88+
<td class="add-comment-right">
89+
{{if eq $line.GetCommentSide "proposed"}}
90+
{{template "repo/diff/conversation" mergeinto $.root "comments" $line.Comments}}
91+
{{end}}
92+
</td>
93+
</tr>
8194
{{end}}
8295
{{end}}
8396
{{end}}

0 commit comments

Comments
 (0)