Skip to content

Commit 4147d57

Browse files
committed
Do not show arrows on comment diffs on pull comment pages
Prior to this PR it was possible that an expansion arrow could be displayed on comment diffs displayed on the comments pages of pulls These arrows would not successfully work because they were not attached to a commit id - nor can they necessarily be. This PR prevents these from being shown. Fix go-gitea#10851 Signed-off-by: Andrew Thornton <[email protected]>
1 parent 2872a04 commit 4147d57

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

templates/repo/diff/section_unified.tmpl

+16-14
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,22 @@
44
<tr class="{{DiffLineTypeToStr .GetType}}-code nl-{{$k}} ol-{{$k}}">
55
{{if eq .GetType 4}}
66
<td colspan="2" class="lines-num">
7-
{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5) }}
8-
<a role="button" class="blob-excerpt" data-url="{{$.root.RepoLink}}/blob_excerpt/{{$.root.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=unified&direction=down" data-anchor="diff-{{Sha1 $file.Name}}K{{$line.SectionInfo.RightIdx}}">
9-
{{svg "octicon-fold-down" 16}}
10-
</a>
11-
{{end}}
12-
{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4) }}
13-
<a role="button" class="blob-excerpt" data-url="{{$.root.RepoLink}}/blob_excerpt/{{$.root.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=unified&direction=up" data-anchor="diff-{{Sha1 $file.Name}}K{{$line.SectionInfo.RightIdx}}">
14-
{{svg "octicon-fold-up" 16}}
15-
</a>
16-
{{end}}
17-
{{if eq $line.GetExpandDirection 2}}
18-
<a role="button" class="blob-excerpt" data-url="{{$.root.RepoLink}}/blob_excerpt/{{$.root.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=unified&direction=" data-anchor="diff-{{Sha1 $file.Name}}K{{$line.SectionInfo.RightIdx}}">
19-
{{svg "octicon-fold" 16}}
20-
</a>
7+
{{if $.root.AfterCommitID}}
8+
{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5) }}
9+
<a role="button" class="blob-excerpt" data-url="{{$.root.RepoLink}}/blob_excerpt/{{$.root.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=unified&direction=down" data-anchor="diff-{{Sha1 $file.Name}}K{{$line.SectionInfo.RightIdx}}">
10+
{{svg "octicon-fold-down" 16}}
11+
</a>
12+
{{end}}
13+
{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4) }}
14+
<a role="button" class="blob-excerpt" data-url="{{$.root.RepoLink}}/blob_excerpt/{{$.root.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=unified&direction=up" data-anchor="diff-{{Sha1 $file.Name}}K{{$line.SectionInfo.RightIdx}}">
15+
{{svg "octicon-fold-up" 16}}
16+
</a>
17+
{{end}}
18+
{{if eq $line.GetExpandDirection 2}}
19+
<a role="button" class="blob-excerpt" data-url="{{$.root.RepoLink}}/blob_excerpt/{{$.root.AfterCommitID}}" data-query="{{$line.GetBlobExcerptQuery}}&style=unified&direction=" data-anchor="diff-{{Sha1 $file.Name}}K{{$line.SectionInfo.RightIdx}}">
20+
{{svg "octicon-fold" 16}}
21+
</a>
22+
{{end}}
2123
{{end}}
2224
</td>
2325
{{else}}

0 commit comments

Comments
 (0)