Skip to content

Commit c083682

Browse files
committed
Show forms only to users who are logged in
Signed-off-by: Jonas Franz <[email protected]>
1 parent 229129d commit c083682

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

templates/repo/diff/box.tmpl

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
<div class="ui right">
99
<a class="ui tiny basic toggle button" href="?style={{if .IsSplitStyle}}unified{{else}}split{{end}}">{{ if .IsSplitStyle }}{{.i18n.Tr "repo.diff.show_unified_view"}}{{else}}{{.i18n.Tr "repo.diff.show_split_view"}}{{end}}</a>
1010
<a class="ui tiny basic toggle button" data-target="#diff-files">{{.i18n.Tr "repo.diff.show_diff_stats"}}</a>
11-
{{template "repo/diff/new_review" .}}
11+
{{if .IsSigned}}
12+
{{template "repo/diff/new_review" .}}
13+
{{end}}
1214
</div>
1315
</div>
1416
<ol class="detail-files hide" id="diff-files">
@@ -104,7 +106,7 @@
104106

105107
</td>
106108
<td class="lines-code lines-code-old halfwidth">
107-
{{if not (len $line.Comments)}}
109+
{{if and $.IsSigned (not (len $line.Comments))}}
108110
<a class="ui green button add-code-comment add-code-comment-right" data-path="{{$file.Name}}" data-side="right" data-idx="{{$line.RightIdx}}">+</a>
109111
{{end}}
110112
<pre><code class="wrap {{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{if $line.LeftIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</code></pre>
@@ -114,7 +116,7 @@
114116
</td>
115117

116118
<td class="lines-code lines-code-new halfwidth">
117-
{{if not (len $line.Comments)}}
119+
{{if and $.IsSigned (not (len $line.Comments))}}
118120
<a class="ui green button add-code-comment add-code-comment-right" data-path="{{$file.Name}}" data-side="right" data-idx="{{$line.RightIdx}}">+</a>
119121
{{end}}
120122
<pre><code class="wrap {{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{if $line.RightIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</code></pre>
@@ -129,7 +131,12 @@
129131
{{ template "repo/diff/comments" dict "root" $ "comments" $line.Comments}}
130132
</ui>
131133
</div>
132-
{{template "repo/diff/comment_form_datahandler" dict "root" $ "comment" (index $line.Comments 0)}}
134+
{{if $.IsSigned}}
135+
{{template "repo/diff/comment_form_datahandler" dict "root" $ "comment" (index $line.Comments 0)}}
136+
{{end}}
137+
{{printf "%v" $}}
138+
<hr>
139+
{{printf "%v" $.IsSigned}}
133140
</div>
134141
</td>
135142
</tr>

templates/repo/diff/section_unified.tmpl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
</td>
1717
{{end}}
1818
<td class="lines-code {{if (not $line.RightIdx)}}lines-code-old{{end}}">
19-
{{if not (len $line.Comments)}}
19+
{{if and $.IsSigned (not (len $line.Comments))}}
2020
<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>
2121
{{end}}
2222
<pre><code class="wrap {{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{$section.GetComputedInlineDiffFor $line}}</code></pre>
@@ -31,7 +31,9 @@
3131
{{ template "repo/diff/comments" dict "root" $.root "comments" $line.Comments}}
3232
</ui>
3333
</div>
34-
{{template "repo/diff/comment_form_datahandler" dict "root" $.root "comment" (index $line.Comments 0)}}
34+
{{if $.IsSigned}}
35+
{{template "repo/diff/comment_form_datahandler" dict "root" $.root "comment" (index $line.Comments 0)}}
36+
{{end}}
3537
</div>
3638
</td>
3739
</tr>

0 commit comments

Comments
 (0)