|
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}}"> |
7 |
| - {{if $resolved}} |
8 |
| - <div class="ui attached header resolved-placeholder gt-df gt-ac gt-sb"> |
9 |
| - <div class="ui grey text gt-df gt-ac gt-fw gt-gap-2"> |
10 |
| - {{svg "octicon-check" 16 "icon gt-mr-2"}} |
11 |
| - <b>{{$resolveDoer.Name}}</b> {{ctx.Locale.Tr "repo.issues.review.resolved_by"}} |
12 |
| - {{if $invalid}} |
13 |
| - <!-- |
14 |
| - We only handle the case $resolved=true and $invalid=true in this template because if the comment is not resolved it has the outdated label in the comments area (not the header above). |
15 |
| - The case $resolved=false and $invalid=true is handled in repo/diff/comments.tmpl |
16 |
| - --> |
17 |
| - <a href="{{$referenceUrl}}" class="ui label basic small gt-ml-3" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.review.outdated_description"}}"> |
18 |
| - {{ctx.Locale.Tr "repo.issues.review.outdated"}} |
19 |
| - </a> |
20 |
| - {{end}} |
| 1 | +{{if len .comments}} |
| 2 | + {{$comment := index .comments 0}} |
| 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}}"> |
| 10 | + {{if $resolved}} |
| 11 | + <div class="ui attached header resolved-placeholder gt-df gt-ac gt-sb"> |
| 12 | + <div class="ui grey text gt-df gt-ac gt-fw gt-gap-2"> |
| 13 | + {{svg "octicon-check" 16 "icon gt-mr-2"}} |
| 14 | + <b>{{$resolveDoer.Name}}</b> {{ctx.Locale.Tr "repo.issues.review.resolved_by"}} |
| 15 | + {{if $invalid}} |
| 16 | + <!-- |
| 17 | + We only handle the case $resolved=true and $invalid=true in this template because if the comment is not resolved it has the outdated label in the comments area (not the header above). |
| 18 | + The case $resolved=false and $invalid=true is handled in repo/diff/comments.tmpl |
| 19 | + --> |
| 20 | + <a href="{{$referenceUrl}}" class="ui label basic small gt-ml-3" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.review.outdated_description"}}"> |
| 21 | + {{ctx.Locale.Tr "repo.issues.review.outdated"}} |
| 22 | + </a> |
| 23 | + {{end}} |
| 24 | + </div> |
| 25 | + <div class="gt-df gt-ac gt-gap-3"> |
| 26 | + <button id="show-outdated-{{$comment.ID}}" data-comment="{{$comment.ID}}" class="ui tiny labeled button show-outdated gt-df gt-ac"> |
| 27 | + {{svg "octicon-unfold" 16 "gt-mr-3"}} |
| 28 | + {{ctx.Locale.Tr "repo.issues.review.show_resolved"}} |
| 29 | + </button> |
| 30 | + <button id="hide-outdated-{{$comment.ID}}" data-comment="{{$comment.ID}}" class="ui tiny labeled button hide-outdated gt-df gt-ac gt-hidden"> |
| 31 | + {{svg "octicon-fold" 16 "gt-mr-3"}} |
| 32 | + {{ctx.Locale.Tr "repo.issues.review.hide_resolved"}} |
| 33 | + </button> |
| 34 | + </div> |
21 | 35 | </div>
|
22 |
| - <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"> |
24 |
| - {{svg "octicon-unfold" 16 "gt-mr-3"}} |
25 |
| - {{ctx.Locale.Tr "repo.issues.review.show_resolved"}} |
26 |
| - </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"> |
28 |
| - {{svg "octicon-fold" 16 "gt-mr-3"}} |
29 |
| - {{ctx.Locale.Tr "repo.issues.review.hide_resolved"}} |
30 |
| - </button> |
| 36 | + {{end}} |
| 37 | + <div id="code-comments-{{$comment.ID}}" class="field comment-code-cloud {{if $resolved}}gt-hidden{{end}}"> |
| 38 | + <div class="comment-list"> |
| 39 | + <ui class="ui comments"> |
| 40 | + {{template "repo/diff/comments" dict "root" $ "comments" .comments}} |
| 41 | + </ui> |
31 | 42 | </div>
|
32 |
| - </div> |
33 |
| - {{end}} |
34 |
| - <div id="code-comments-{{(index .comments 0).ID}}" class="field comment-code-cloud {{if $resolved}}gt-hidden{{end}}"> |
35 |
| - <div class="comment-list"> |
36 |
| - <ui class="ui comments"> |
37 |
| - {{template "repo/diff/comments" dict "root" $ "comments" .comments}} |
38 |
| - </ui> |
39 |
| - </div> |
40 |
| - <div class="gt-df gt-je gt-ac gt-fw gt-mt-3"> |
41 |
| - <div class="ui buttons gt-mr-2"> |
42 |
| - <button class="ui icon tiny basic button previous-conversation"> |
43 |
| - {{svg "octicon-arrow-up" 12 "icon"}} {{ctx.Locale.Tr "repo.issues.previous"}} |
44 |
| - </button> |
45 |
| - <button class="ui icon tiny basic button next-conversation"> |
46 |
| - {{svg "octicon-arrow-down" 12 "icon"}} {{ctx.Locale.Tr "repo.issues.next"}} |
47 |
| - </button> |
| 43 | + <div class="gt-df gt-je gt-ac gt-fw gt-mt-3"> |
| 44 | + <div class="ui buttons gt-mr-2"> |
| 45 | + <button class="ui icon tiny basic button previous-conversation"> |
| 46 | + {{svg "octicon-arrow-up" 12 "icon"}} {{ctx.Locale.Tr "repo.issues.previous"}} |
| 47 | + </button> |
| 48 | + <button class="ui icon tiny basic button next-conversation"> |
| 49 | + {{svg "octicon-arrow-down" 12 "icon"}} {{ctx.Locale.Tr "repo.issues.next"}} |
| 50 | + </button> |
| 51 | + </div> |
| 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"> |
| 54 | + {{if $resolved}} |
| 55 | + {{ctx.Locale.Tr "repo.issues.review.un_resolve_conversation"}} |
| 56 | + {{else}} |
| 57 | + {{ctx.Locale.Tr "repo.issues.review.resolve_conversation"}} |
| 58 | + {{end}} |
| 59 | + </button> |
| 60 | + {{end}} |
| 61 | + {{if and $.SignedUserID (not $.Repository.IsArchived)}} |
| 62 | + <button class="comment-form-reply ui primary tiny labeled icon button gt-ml-2 gt-mr-0"> |
| 63 | + {{svg "octicon-reply" 16 "reply icon gt-mr-2"}}{{ctx.Locale.Tr "repo.diff.comment.reply"}} |
| 64 | + </button> |
| 65 | + {{end}} |
48 | 66 | </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"> |
51 |
| - {{if $resolved}} |
52 |
| - {{ctx.Locale.Tr "repo.issues.review.un_resolve_conversation"}} |
53 |
| - {{else}} |
54 |
| - {{ctx.Locale.Tr "repo.issues.review.resolve_conversation"}} |
55 |
| - {{end}} |
56 |
| - </button> |
57 |
| - {{end}} |
58 |
| - {{if and $.SignedUserID (not $.Repository.IsArchived)}} |
59 |
| - <button class="comment-form-reply ui primary tiny labeled icon button gt-ml-2 gt-mr-0"> |
60 |
| - {{svg "octicon-reply" 16 "reply icon gt-mr-2"}}{{ctx.Locale.Tr "repo.diff.comment.reply"}} |
61 |
| - </button> |
62 |
| - {{end}} |
| 67 | + {{template "repo/diff/comment_form_datahandler" dict "hidden" true "reply" $comment.ReviewID "root" $ "comment" $comment}} |
63 | 68 | </div>
|
64 |
| - {{template "repo/diff/comment_form_datahandler" dict "hidden" true "reply" (index .comments 0).ReviewID "root" $ "comment" (index .comments 0)}} |
65 | 69 | </div>
|
66 |
| -</div> |
| 70 | +{{else}} |
| 71 | + {{template "repo/diff/conversation_outdated"}} |
| 72 | +{{end}} |
0 commit comments