|
1 | 1 | {{$diffBlobExcerptData := .DiffBlobExcerptData}} |
| 2 | +{{$canCreateComment := and ctx.RootData.SignedUserID $diffBlobExcerptData.PullIssueIndex}} |
2 | 3 | {{if $.IsSplitStyle}} |
3 | 4 | {{range $k, $line := $.section.Lines}} |
4 | 5 | <tr class="{{.GetHTMLDiffLineType}}-code nl-{{$k}} ol-{{$k}} line-expanded" data-line-type="{{.GetHTMLDiffLineType}}"> |
|
14 | 15 | <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> |
15 | 16 | <td class="lines-type-marker lines-type-marker-old">{{if $line.LeftIdx}}<span class="tw-font-mono" data-type-marker=""></span>{{end}}</td> |
16 | 17 | <td class="lines-code lines-code-old"> |
17 | | - {{- if and $.SignedUserID $.PageIsPullFiles $line.LeftIdx -}} |
| 18 | + {{- if and $canCreateComment $line.LeftIdx -}} |
18 | 19 | <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}}"> |
19 | 20 | {{- svg "octicon-plus" -}} |
20 | 21 | </button> |
|
29 | 30 | <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> |
30 | 31 | <td class="lines-type-marker lines-type-marker-new">{{if $line.RightIdx}}<span class="tw-font-mono" data-type-marker=""></span>{{end}}</td> |
31 | 32 | <td class="lines-code lines-code-new"> |
32 | | - {{- if and $.SignedUserID $.PageIsPullFiles $line.RightIdx -}} |
| 33 | + {{- if and $canCreateComment $line.RightIdx -}} |
33 | 34 | <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}}"> |
34 | 35 | {{- svg "octicon-plus" -}} |
35 | 36 | </button> |
|
70 | 71 | <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> |
71 | 72 | <td class="lines-type-marker"><span class="tw-font-mono" data-type-marker="{{$line.GetLineTypeMarker}}"></span></td> |
72 | 73 | <td class="lines-code{{if (not $line.RightIdx)}} lines-code-old{{end}}"> |
73 | | - {{- if and ctx.RootData.SignedUserID $diffBlobExcerptData.PullIssueIndex -}} |
| 74 | + {{- if and $canCreateComment -}} |
74 | 75 | <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}}"> |
75 | 76 | {{- svg "octicon-plus" -}} |
76 | 77 | </button> |
|
0 commit comments