|
1 |
| -{{$invalid := (index .comments 0).Invalidated}} |
2 |
| -{{$resolved := (index .comments 0).IsResolved}} |
3 |
| -{{$resolveDoer := (index .comments 0).ResolveDoer}} |
4 |
| -{{$isNotPending := (not (eq (index .comments 0).Review.Type 0))}} |
5 |
| -<div class="ui segments conversation-holder"> |
6 |
| - <div class="ui segment collapsible-comment-box gt-py-3 gt-df gt-ac gt-sb"> |
7 |
| - <div class="gt-df gt-ac"> |
8 |
| - <a href="{{(index .comments 0).CodeCommentLink ctx}}" class="file-comment gt-ml-3 gt-word-break">{{(index .comments 0).TreePath}}</a> |
9 |
| - {{if $invalid}} |
10 |
| - <span class="ui label basic small gt-ml-3" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.review.outdated_description"}}"> |
11 |
| - {{ctx.Locale.Tr "repo.issues.review.outdated"}} |
12 |
| - </span> |
13 |
| - {{end}} |
14 |
| - </div> |
15 |
| - <div> |
16 |
| - {{if or $invalid $resolved}} |
17 |
| - <button id="show-outdated-{{(index .comments 0).ID}}" data-comment="{{(index .comments 0).ID}}" class="{{if not $resolved}}gt-hidden {{end}}ui compact labeled button show-outdated gt-df gt-ac"> |
18 |
| - {{svg "octicon-unfold" 16 "gt-mr-3"}} |
19 |
| - {{if $resolved}} |
20 |
| - {{ctx.Locale.Tr "repo.issues.review.show_resolved"}} |
21 |
| - {{else}} |
22 |
| - {{ctx.Locale.Tr "repo.issues.review.show_outdated"}} |
23 |
| - {{end}} |
24 |
| - </button> |
25 |
| - <button id="hide-outdated-{{(index .comments 0).ID}}" data-comment="{{(index .comments 0).ID}}" class="{{if $resolved}}gt-hidden {{end}}ui compact labeled button hide-outdated gt-df gt-ac"> |
26 |
| - {{svg "octicon-fold" 16 "gt-mr-3"}} |
27 |
| - {{if $resolved}} |
28 |
| - {{ctx.Locale.Tr "repo.issues.review.hide_resolved"}} |
29 |
| - {{else}} |
30 |
| - {{ctx.Locale.Tr "repo.issues.review.hide_outdated"}} |
31 |
| - {{end}} |
32 |
| - </button> |
33 |
| - {{end}} |
| 1 | +{{if len .comments}} |
| 2 | + {{$comment := index .comments 0}} |
| 3 | + {{$invalid := $comment.Invalidated}} |
| 4 | + {{$resolved := $comment.IsResolved}} |
| 5 | + {{$resolveDoer := $comment.ResolveDoer}} |
| 6 | + {{$hasReview := and $comment.Review}} |
| 7 | + {{$isReviewPending := and $hasReview (eq $comment.Review.Type 0)}} |
| 8 | + <div class="ui segments conversation-holder"> |
| 9 | + <div class="ui segment collapsible-comment-box gt-py-3 gt-df gt-ac gt-sb"> |
| 10 | + <div class="gt-df gt-ac"> |
| 11 | + <a href="{{$comment.CodeCommentLink ctx}}" class="file-comment gt-ml-3 gt-word-break">{{$comment.TreePath}}</a> |
| 12 | + {{if $invalid}} |
| 13 | + <span class="ui label basic small gt-ml-3" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.review.outdated_description"}}"> |
| 14 | + {{ctx.Locale.Tr "repo.issues.review.outdated"}} |
| 15 | + </span> |
| 16 | + {{end}} |
| 17 | + </div> |
| 18 | + <div> |
| 19 | + {{if or $invalid $resolved}} |
| 20 | + <button id="show-outdated-{{$comment.ID}}" data-comment="{{$comment.ID}}" class="{{if not $resolved}}gt-hidden {{end}}ui compact labeled button show-outdated gt-df gt-ac"> |
| 21 | + {{svg "octicon-unfold" 16 "gt-mr-3"}} |
| 22 | + {{if $resolved}} |
| 23 | + {{ctx.Locale.Tr "repo.issues.review.show_resolved"}} |
| 24 | + {{else}} |
| 25 | + {{ctx.Locale.Tr "repo.issues.review.show_outdated"}} |
| 26 | + {{end}} |
| 27 | + </button> |
| 28 | + <button id="hide-outdated-{{$comment.ID}}" data-comment="{{$comment.ID}}" class="{{if $resolved}}gt-hidden {{end}}ui compact labeled button hide-outdated gt-df gt-ac"> |
| 29 | + {{svg "octicon-fold" 16 "gt-mr-3"}} |
| 30 | + {{if $resolved}} |
| 31 | + {{ctx.Locale.Tr "repo.issues.review.hide_resolved"}} |
| 32 | + {{else}} |
| 33 | + {{ctx.Locale.Tr "repo.issues.review.hide_outdated"}} |
| 34 | + {{end}} |
| 35 | + </button> |
| 36 | + {{end}} |
| 37 | + </div> |
34 | 38 | </div>
|
35 |
| - </div> |
36 |
| - {{$diff := (CommentMustAsDiff ctx (index .comments 0))}} |
37 |
| - {{if $diff}} |
38 |
| - {{$file := (index $diff.Files 0)}} |
39 |
| - <div id="code-preview-{{(index .comments 0).ID}}" class="ui table segment{{if $resolved}} gt-hidden{{end}}"> |
40 |
| - <div class="diff-file-box diff-box file-content {{TabSizeClass $.Editorconfig $file.Name}}"> |
41 |
| - <div class="file-body file-code code-view code-diff code-diff-unified unicode-escaped"> |
42 |
| - <table> |
43 |
| - <tbody> |
44 |
| - {{template "repo/diff/section_unified" dict "file" $file "root" $}} |
45 |
| - </tbody> |
46 |
| - </table> |
| 39 | + {{$diff := (CommentMustAsDiff ctx $comment)}} |
| 40 | + {{if $diff}} |
| 41 | + {{$file := (index $diff.Files 0)}} |
| 42 | + <div id="code-preview-{{$comment.ID}}" class="ui table segment{{if $resolved}} gt-hidden{{end}}"> |
| 43 | + <div class="diff-file-box diff-box file-content {{TabSizeClass $.Editorconfig $file.Name}}"> |
| 44 | + <div class="file-body file-code code-view code-diff code-diff-unified unicode-escaped"> |
| 45 | + <table> |
| 46 | + <tbody> |
| 47 | + {{template "repo/diff/section_unified" dict "file" $file "root" $}} |
| 48 | + </tbody> |
| 49 | + </table> |
| 50 | + </div> |
47 | 51 | </div>
|
48 | 52 | </div>
|
49 |
| - </div> |
50 |
| - {{end}} |
51 |
| - <div id="code-comments-{{(index .comments 0).ID}}" class="comment-code-cloud ui segment{{if $resolved}} gt-hidden{{end}}"> |
52 |
| - <div class="ui comments gt-mb-0"> |
53 |
| - {{range .comments}} |
54 |
| - {{$createdSubStr:= TimeSinceUnix .CreatedUnix ctx.Locale}} |
55 |
| - <div class="comment code-comment gt-pb-4" id="{{.HashTag}}"> |
56 |
| - <div class="content"> |
57 |
| - <div class="header comment-header"> |
58 |
| - <div class="comment-header-left gt-df gt-ac"> |
59 |
| - {{if not .OriginalAuthor}} |
60 |
| - <a class="avatar"> |
61 |
| - {{ctx.AvatarUtils.Avatar .Poster 20}} |
62 |
| - </a> |
63 |
| - {{end}} |
64 |
| - <span class="text grey muted-links"> |
65 |
| - {{if .OriginalAuthor}} |
66 |
| - <span class="text black"> |
67 |
| - {{svg (MigrationIcon $.Repository.GetOriginalURLHostname)}} |
68 |
| - {{.OriginalAuthor}} |
69 |
| - </span> |
70 |
| - {{if $.Repository.OriginalURL}} |
71 |
| - <span class="migrate">({{ctx.Locale.Tr "repo.migrated_from" $.Repository.OriginalURL $.Repository.GetOriginalURLHostname}})</span> |
| 53 | + {{end}} |
| 54 | + <div id="code-comments-{{$comment.ID}}" class="comment-code-cloud ui segment{{if $resolved}} gt-hidden{{end}}"> |
| 55 | + <div class="ui comments gt-mb-0"> |
| 56 | + {{range .comments}} |
| 57 | + {{$createdSubStr:= TimeSinceUnix .CreatedUnix ctx.Locale}} |
| 58 | + <div class="comment code-comment gt-pb-4" id="{{.HashTag}}"> |
| 59 | + <div class="content"> |
| 60 | + <div class="header comment-header"> |
| 61 | + <div class="comment-header-left gt-df gt-ac"> |
| 62 | + {{if not .OriginalAuthor}} |
| 63 | + <a class="avatar"> |
| 64 | + {{ctx.AvatarUtils.Avatar .Poster 20}} |
| 65 | + </a> |
| 66 | + {{end}} |
| 67 | + <span class="text grey muted-links"> |
| 68 | + {{if .OriginalAuthor}} |
| 69 | + <span class="text black"> |
| 70 | + {{svg (MigrationIcon $.Repository.GetOriginalURLHostname)}} |
| 71 | + {{.OriginalAuthor}} |
| 72 | + </span> |
| 73 | + {{if $.Repository.OriginalURL}} |
| 74 | + <span class="migrate">({{ctx.Locale.Tr "repo.migrated_from" $.Repository.OriginalURL $.Repository.GetOriginalURLHostname}})</span> |
| 75 | + {{end}} |
| 76 | + {{else}} |
| 77 | + {{template "shared/user/authorlink" .Poster}} |
72 | 78 | {{end}}
|
73 |
| - {{else}} |
74 |
| - {{template "shared/user/authorlink" .Poster}} |
| 79 | + {{ctx.Locale.Tr "repo.issues.commented_at" .HashTag $createdSubStr}} |
| 80 | + </span> |
| 81 | + </div> |
| 82 | + <div class="comment-header-right actions gt-df gt-ac"> |
| 83 | + {{template "repo/issue/view_content/show_role" dict "ShowRole" .ShowRole}} |
| 84 | + {{if not $.Repository.IsArchived}} |
| 85 | + {{template "repo/issue/view_content/add_reaction" dict "ctxData" $ "ActionURL" (printf "%s/comments/%d/reactions" $.RepoLink .ID)}} |
| 86 | + {{template "repo/issue/view_content/context_menu" dict "ctxData" $ "item" . "delete" true "issue" true "diff" true "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}} |
75 | 87 | {{end}}
|
76 |
| - {{ctx.Locale.Tr "repo.issues.commented_at" .HashTag $createdSubStr}} |
77 |
| - </span> |
| 88 | + </div> |
78 | 89 | </div>
|
79 |
| - <div class="comment-header-right actions gt-df gt-ac"> |
80 |
| - {{template "repo/issue/view_content/show_role" dict "ShowRole" .ShowRole}} |
81 |
| - {{if not $.Repository.IsArchived}} |
82 |
| - {{template "repo/issue/view_content/add_reaction" dict "ctxData" $ "ActionURL" (printf "%s/comments/%d/reactions" $.RepoLink .ID)}} |
83 |
| - {{template "repo/issue/view_content/context_menu" dict "ctxData" $ "item" . "delete" true "issue" true "diff" true "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}} |
| 90 | + <div class="text comment-content"> |
| 91 | + <div class="render-content markup" {{if or $.Permission.IsAdmin $.HasIssuesOrPullsWritePermission (and $.IsSigned (eq $.SignedUserID .PosterID))}}data-can-edit="true"{{end}}> |
| 92 | + {{if .RenderedContent}} |
| 93 | + {{.RenderedContent}} |
| 94 | + {{else}} |
| 95 | + <span class="no-content">{{ctx.Locale.Tr "repo.issues.no_content"}}</span> |
| 96 | + {{end}} |
| 97 | + </div> |
| 98 | + <div id="issuecomment-{{.ID}}-raw" class="raw-content gt-hidden">{{.Content}}</div> |
| 99 | + <div class="edit-content-zone gt-hidden" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div> |
| 100 | + {{if .Attachments}} |
| 101 | + {{template "repo/issue/view_content/attachments" dict "Attachments" .Attachments "RenderedContent" .RenderedContent}} |
84 | 102 | {{end}}
|
85 | 103 | </div>
|
86 |
| - </div> |
87 |
| - <div class="text comment-content"> |
88 |
| - <div class="render-content markup" {{if or $.Permission.IsAdmin $.HasIssuesOrPullsWritePermission (and $.IsSigned (eq $.SignedUserID .PosterID))}}data-can-edit="true"{{end}}> |
89 |
| - {{if .RenderedContent}} |
90 |
| - {{.RenderedContent}} |
91 |
| - {{else}} |
92 |
| - <span class="no-content">{{ctx.Locale.Tr "repo.issues.no_content"}}</span> |
93 |
| - {{end}} |
94 |
| - </div> |
95 |
| - <div id="issuecomment-{{.ID}}-raw" class="raw-content gt-hidden">{{.Content}}</div> |
96 |
| - <div class="edit-content-zone gt-hidden" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div> |
97 |
| - {{if .Attachments}} |
98 |
| - {{template "repo/issue/view_content/attachments" dict "Attachments" .Attachments "RenderedContent" .RenderedContent}} |
| 104 | + {{$reactions := .Reactions.GroupByType}} |
| 105 | + {{if $reactions}} |
| 106 | + {{template "repo/issue/view_content/reactions" dict "ctxData" $ "ActionURL" (printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}} |
99 | 107 | {{end}}
|
100 | 108 | </div>
|
101 |
| - {{$reactions := .Reactions.GroupByType}} |
102 |
| - {{if $reactions}} |
103 |
| - {{template "repo/issue/view_content/reactions" dict "ctxData" $ "ActionURL" (printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}} |
104 |
| - {{end}} |
105 |
| - </div> |
106 |
| - </div> |
107 |
| - {{end}} |
108 |
| - </div> |
109 |
| - <div class="code-comment-buttons gt-df gt-ac gt-fw gt-mt-3 gt-mb-2 gt-mx-3"> |
110 |
| - <div class="gt-f1"> |
111 |
| - {{if $resolved}} |
112 |
| - <div class="ui grey text"> |
113 |
| - {{svg "octicon-check" 16 "gt-mr-2"}} |
114 |
| - <b>{{$resolveDoer.Name}}</b> {{ctx.Locale.Tr "repo.issues.review.resolved_by"}} |
115 | 109 | </div>
|
116 | 110 | {{end}}
|
117 | 111 | </div>
|
118 |
| - <div class="code-comment-buttons-buttons"> |
119 |
| - {{if and $.CanMarkConversation $isNotPending}} |
120 |
| - <button class="ui tiny basic button resolve-conversation" data-origin="timeline" data-action="{{if not $resolved}}Resolve{{else}}UnResolve{{end}}" data-comment-id="{{(index .comments 0).ID}}" data-update-url="{{$.RepoLink}}/issues/resolve_conversation"> |
121 |
| - {{if $resolved}} |
122 |
| - {{ctx.Locale.Tr "repo.issues.review.un_resolve_conversation"}} |
123 |
| - {{else}} |
124 |
| - {{ctx.Locale.Tr "repo.issues.review.resolve_conversation"}} |
125 |
| - {{end}} |
126 |
| - </button> |
127 |
| - {{end}} |
128 |
| - {{if and $.SignedUserID (not $.Repository.IsArchived)}} |
129 |
| - <button class="comment-form-reply ui primary tiny labeled icon button gt-ml-2 gt-mr-0"> |
130 |
| - {{svg "octicon-reply" 16 "reply icon gt-mr-2"}}{{ctx.Locale.Tr "repo.diff.comment.reply"}} |
131 |
| - </button> |
132 |
| - {{end}} |
| 112 | + <div class="code-comment-buttons gt-df gt-ac gt-fw gt-mt-3 gt-mb-2 gt-mx-3"> |
| 113 | + <div class="gt-f1"> |
| 114 | + {{if $resolved}} |
| 115 | + <div class="ui grey text"> |
| 116 | + {{svg "octicon-check" 16 "gt-mr-2"}} |
| 117 | + <b>{{$resolveDoer.Name}}</b> {{ctx.Locale.Tr "repo.issues.review.resolved_by"}} |
| 118 | + </div> |
| 119 | + {{end}} |
| 120 | + </div> |
| 121 | + <div class="code-comment-buttons-buttons"> |
| 122 | + {{if and $.CanMarkConversation $hasReview (not $isReviewPending)}} |
| 123 | + <button class="ui tiny basic button resolve-conversation" data-origin="timeline" data-action="{{if not $resolved}}Resolve{{else}}UnResolve{{end}}" data-comment-id="{{$comment.ID}}" data-update-url="{{$.RepoLink}}/issues/resolve_conversation"> |
| 124 | + {{if $resolved}} |
| 125 | + {{ctx.Locale.Tr "repo.issues.review.un_resolve_conversation"}} |
| 126 | + {{else}} |
| 127 | + {{ctx.Locale.Tr "repo.issues.review.resolve_conversation"}} |
| 128 | + {{end}} |
| 129 | + </button> |
| 130 | + {{end}} |
| 131 | + {{if and $.SignedUserID (not $.Repository.IsArchived)}} |
| 132 | + <button class="comment-form-reply ui primary tiny labeled icon button gt-ml-2 gt-mr-0"> |
| 133 | + {{svg "octicon-reply" 16 "reply icon gt-mr-2"}}{{ctx.Locale.Tr "repo.diff.comment.reply"}} |
| 134 | + </button> |
| 135 | + {{end}} |
| 136 | + </div> |
133 | 137 | </div>
|
| 138 | + {{template "repo/diff/comment_form_datahandler" dict "hidden" true "reply" $comment.ReviewID "root" $ "comment" $comment}} |
134 | 139 | </div>
|
135 |
| - {{template "repo/diff/comment_form_datahandler" dict "hidden" true "reply" (index .comments 0).ReviewID "root" $ "comment" (index .comments 0)}} |
136 | 140 | </div>
|
137 |
| -</div> |
| 141 | +{{else}} |
| 142 | + {{template "repo/diff/conversation_outdated"}} |
| 143 | +{{end}} |
0 commit comments