Skip to content

Commit 41a40c0

Browse files
committed
fix
1 parent 34290a0 commit 41a40c0

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

templates/repo/diff/comments.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
{{ctx.Locale.Tr "repo.issues.review.outdated"}}
3838
</a>
3939
{{end}}
40-
{{if and .Review}}
40+
{{if .Review}}
4141
{{if eq .Review.Type 0}}
4242
<div class="ui label basic small yellow pending-label" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.review.pending.tooltip" (ctx.Locale.Tr "repo.diff.review") (ctx.Locale.Tr "repo.diff.review.approve") (ctx.Locale.Tr "repo.diff.review.comment") (ctx.Locale.Tr "repo.diff.review.reject")}}">
4343
{{ctx.Locale.Tr "repo.issues.review.pending"}}

templates/repo/diff/conversation.tmpl

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
{{$resolved := (index .comments 0).IsResolved}}
2-
{{$invalid := (index .comments 0).Invalidated}}
3-
{{$resolveDoer := (index .comments 0).ResolveDoer}}
4-
{{$isNotPending := (not (eq (index .comments 0).Review.Type 0))}}
5-
{{$referenceUrl := printf "%s#%s" $.Issue.Link (index .comments 0).HashTag}}
6-
<div class="conversation-holder" data-path="{{(index .comments 0).TreePath}}" data-side="{{if lt (index .comments 0).Line 0}}left{{else}}right{{end}}" data-idx="{{(index .comments 0).UnsignedLine}}">
1+
{{$comment := index .comments 0}}
2+
{{if $comment}}
3+
{{$resolved := $comment.IsResolved}}
4+
{{$invalid := $comment.Invalidated}}
5+
{{$resolveDoer := $comment.ResolveDoer}}
6+
{{$hasReview := and $comment.Review}}
7+
{{$isReviewPending := and $hasReview (eq $comment.Review.Type 0)}}
8+
{{$referenceUrl := printf "%s#%s" $.Issue.Link $comment.HashTag}}
9+
<div class="conversation-holder" data-path="{{$comment.TreePath}}" data-side="{{if lt $comment.Line 0}}left{{else}}right{{end}}" data-idx="{{$comment.UnsignedLine}}">
710
{{if $resolved}}
811
<div class="ui attached header resolved-placeholder gt-df gt-ac gt-sb">
912
<div class="ui grey text gt-df gt-ac gt-fw gt-gap-2">
@@ -20,18 +23,18 @@
2023
{{end}}
2124
</div>
2225
<div class="gt-df gt-ac gt-gap-3">
23-
<button id="show-outdated-{{(index .comments 0).ID}}" data-comment="{{(index .comments 0).ID}}" class="ui tiny labeled button show-outdated gt-df gt-ac">
26+
<button id="show-outdated-{{$comment.ID}}" data-comment="{{$comment.ID}}" class="ui tiny labeled button show-outdated gt-df gt-ac">
2427
{{svg "octicon-unfold" 16 "gt-mr-3"}}
2528
{{ctx.Locale.Tr "repo.issues.review.show_resolved"}}
2629
</button>
27-
<button id="hide-outdated-{{(index .comments 0).ID}}" data-comment="{{(index .comments 0).ID}}" class="ui tiny labeled button hide-outdated gt-df gt-ac gt-hidden">
30+
<button id="hide-outdated-{{$comment.ID}}" data-comment="{{$comment.ID}}" class="ui tiny labeled button hide-outdated gt-df gt-ac gt-hidden">
2831
{{svg "octicon-fold" 16 "gt-mr-3"}}
2932
{{ctx.Locale.Tr "repo.issues.review.hide_resolved"}}
3033
</button>
3134
</div>
3235
</div>
3336
{{end}}
34-
<div id="code-comments-{{(index .comments 0).ID}}" class="field comment-code-cloud {{if $resolved}}gt-hidden{{end}}">
37+
<div id="code-comments-{{$comment.ID}}" class="field comment-code-cloud {{if $resolved}}gt-hidden{{end}}">
3538
<div class="comment-list">
3639
<ui class="ui comments">
3740
{{template "repo/diff/comments" dict "root" $ "comments" .comments}}
@@ -46,8 +49,8 @@
4649
{{svg "octicon-arrow-down" 12 "icon"}} {{ctx.Locale.Tr "repo.issues.next"}}
4750
</button>
4851
</div>
49-
{{if and $.CanMarkConversation $isNotPending}}
50-
<button class="ui icon tiny basic button resolve-conversation" data-origin="diff" data-action="{{if not $resolved}}Resolve{{else}}UnResolve{{end}}" data-comment-id="{{(index .comments 0).ID}}" data-update-url="{{$.RepoLink}}/issues/resolve_conversation">
52+
{{if and $.CanMarkConversation $hasReview (not $isReviewPending)}}
53+
<button class="ui icon tiny basic button resolve-conversation" data-origin="diff" data-action="{{if not $resolved}}Resolve{{else}}UnResolve{{end}}" data-comment-id="{{$comment.ID}}" data-update-url="{{$.RepoLink}}/issues/resolve_conversation">
5154
{{if $resolved}}
5255
{{ctx.Locale.Tr "repo.issues.review.un_resolve_conversation"}}
5356
{{else}}
@@ -61,6 +64,9 @@
6164
</button>
6265
{{end}}
6366
</div>
64-
{{template "repo/diff/comment_form_datahandler" dict "hidden" true "reply" (index .comments 0).ReviewID "root" $ "comment" (index .comments 0)}}
67+
{{template "repo/diff/comment_form_datahandler" dict "hidden" true "reply" $comment.ReviewID "root" $ "comment" $comment}}
6568
</div>
6669
</div>
70+
{{else}}
71+
{{template "repo/diff/conversation_outdated"}}
72+
{{end}}

0 commit comments

Comments
 (0)