|
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}}"> |
7 | 10 | {{if $resolved}} |
8 | 11 | <div class="ui attached header resolved-placeholder gt-df gt-ac gt-sb"> |
9 | 12 | <div class="ui grey text gt-df gt-ac gt-fw gt-gap-2"> |
|
20 | 23 | {{end}} |
21 | 24 | </div> |
22 | 25 | <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"> |
24 | 27 | {{svg "octicon-unfold" 16 "gt-mr-3"}} |
25 | 28 | {{ctx.Locale.Tr "repo.issues.review.show_resolved"}} |
26 | 29 | </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"> |
28 | 31 | {{svg "octicon-fold" 16 "gt-mr-3"}} |
29 | 32 | {{ctx.Locale.Tr "repo.issues.review.hide_resolved"}} |
30 | 33 | </button> |
31 | 34 | </div> |
32 | 35 | </div> |
33 | 36 | {{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}}"> |
35 | 38 | <div class="comment-list"> |
36 | 39 | <ui class="ui comments"> |
37 | 40 | {{template "repo/diff/comments" dict "root" $ "comments" .comments}} |
|
46 | 49 | {{svg "octicon-arrow-down" 12 "icon"}} {{ctx.Locale.Tr "repo.issues.next"}} |
47 | 50 | </button> |
48 | 51 | </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"> |
51 | 54 | {{if $resolved}} |
52 | 55 | {{ctx.Locale.Tr "repo.issues.review.un_resolve_conversation"}} |
53 | 56 | {{else}} |
|
61 | 64 | </button> |
62 | 65 | {{end}} |
63 | 66 | </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}} |
65 | 68 | </div> |
66 | 69 | </div> |
| 70 | +{{else}} |
| 71 | +{{template "repo/diff/conversation_outdated"}} |
| 72 | +{{end}} |
0 commit comments