Skip to content

Commit 38d40a6

Browse files
committed
fix tmpl var
1 parent a95ebbb commit 38d40a6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

templates/repo/diff/blob_excerpt.tmpl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{{$diffBlobExcerptData := .DiffBlobExcerptData}}
2+
{{$canCreateComment := and ctx.RootData.SignedUserID $diffBlobExcerptData.PullIssueIndex}}
23
{{if $.IsSplitStyle}}
34
{{range $k, $line := $.section.Lines}}
45
<tr class="{{.GetHTMLDiffLineType}}-code nl-{{$k}} ol-{{$k}} line-expanded" data-line-type="{{.GetHTMLDiffLineType}}">
@@ -14,7 +15,7 @@
1415
<td class="lines-escape lines-escape-old">{{if and $line.LeftIdx $inlineDiff.EscapeStatus.Escaped}}<button class="toggle-escape-button btn interact-bg" title="{{template "repo/diff/escape_title" dict "diff" $inlineDiff}}"></button>{{end}}</td>
1516
<td class="lines-type-marker lines-type-marker-old">{{if $line.LeftIdx}}<span class="tw-font-mono" data-type-marker=""></span>{{end}}</td>
1617
<td class="lines-code lines-code-old">
17-
{{- if and $.SignedUserID $.PageIsPullFiles $line.LeftIdx -}}
18+
{{- if and $canCreateComment $line.LeftIdx -}}
1819
<button type="button" aria-label="{{ctx.Locale.Tr "repo.diff.comment.add_line_comment"}}" class="ui primary button add-code-comment add-code-comment-left{{if (not $line.CanComment)}} tw-invisible{{end}}" data-side="left" data-idx="{{$line.LeftIdx}}">
1920
{{- svg "octicon-plus" -}}
2021
</button>
@@ -29,7 +30,7 @@
2930
<td class="lines-escape lines-escape-new">{{if and $line.RightIdx $inlineDiff.EscapeStatus.Escaped}}<button class="toggle-escape-button btn interact-bg" title="{{template "repo/diff/escape_title" dict "diff" $inlineDiff}}"></button>{{end}}</td>
3031
<td class="lines-type-marker lines-type-marker-new">{{if $line.RightIdx}}<span class="tw-font-mono" data-type-marker=""></span>{{end}}</td>
3132
<td class="lines-code lines-code-new">
32-
{{- if and $.SignedUserID $.PageIsPullFiles $line.RightIdx -}}
33+
{{- if and $canCreateComment $line.RightIdx -}}
3334
<button type="button" aria-label="{{ctx.Locale.Tr "repo.diff.comment.add_line_comment"}}" class="ui primary button add-code-comment add-code-comment-right{{if (not $line.CanComment)}} tw-invisible{{end}}" data-side="right" data-idx="{{$line.RightIdx}}">
3435
{{- svg "octicon-plus" -}}
3536
</button>
@@ -70,7 +71,7 @@
7071
<td class="lines-escape">{{if $inlineDiff.EscapeStatus.Escaped}}<button class="toggle-escape-button btn interact-bg" title="{{template "repo/diff/escape_title" dict "diff" $inlineDiff}}"></button>{{end}}</td>
7172
<td class="lines-type-marker"><span class="tw-font-mono" data-type-marker="{{$line.GetLineTypeMarker}}"></span></td>
7273
<td class="lines-code{{if (not $line.RightIdx)}} lines-code-old{{end}}">
73-
{{- if and ctx.RootData.SignedUserID $diffBlobExcerptData.PullIssueIndex -}}
74+
{{- if and $canCreateComment -}}
7475
<button type="button" aria-label="{{ctx.Locale.Tr "repo.diff.comment.add_line_comment"}}" class="ui primary button add-code-comment add-code-comment-{{if $line.RightIdx}}right{{else}}left{{end}}{{if (not $line.CanComment)}} tw-invisible{{end}}" data-side="{{if $line.RightIdx}}right{{else}}left{{end}}" data-idx="{{if $line.RightIdx}}{{$line.RightIdx}}{{else}}{{$line.LeftIdx}}{{end}}">
7576
{{- svg "octicon-plus" -}}
7677
</button>

0 commit comments

Comments
 (0)