code.gitea.io/gitea@v1.22.3/templates/repo/issue/view_content/conversation.tmpl (about)

     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 tw-py-2 tw-flex tw-items-center tw-justify-between">
    10  			<div class="tw-flex tw-items-center">
    11  				<a href="{{$comment.CodeCommentLink ctx}}" class="file-comment tw-ml-2 gt-word-break">{{$comment.TreePath}}</a>
    12  				{{if $invalid}}
    13  					<span class="ui label basic small tw-ml-2" 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}}tw-hidden {{end}}ui compact labeled button show-outdated tw-flex tw-items-center">
    21  						{{svg "octicon-unfold" 16 "tw-mr-2"}}
    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}}tw-hidden {{end}}ui compact labeled button hide-outdated tw-flex tw-items-center">
    29  						{{svg "octicon-fold" 16 "tw-mr-2"}}
    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>
    38  		</div>
    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}} tw-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>
    51  				</div>
    52  			</div>
    53  		{{end}}
    54  		<div id="code-comments-{{$comment.ID}}" class="comment-code-cloud ui segment{{if $resolved}} tw-hidden{{end}}">
    55  			<div class="ui comments tw-mb-0">
    56  				{{range .comments}}
    57  					{{$createdSubStr:= TimeSinceUnix .CreatedUnix ctx.Locale}}
    58  					<div class="comment code-comment" id="{{.HashTag}}">
    59  						<div class="content comment-container">
    60  							<div class="header comment-header">
    61  								<div class="comment-header-left tw-flex tw-items-center">
    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}}
    78  										{{end}}
    79  										{{ctx.Locale.Tr "repo.issues.commented_at" .HashTag $createdSubStr}}
    80  									</span>
    81  								</div>
    82  								<div class="comment-header-right actions tw-flex tw-items-center">
    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 "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))}}
    87  									{{end}}
    88  								</div>
    89  							</div>
    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 tw-hidden">{{.Content}}</div>
    99  								<div class="edit-content-zone tw-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}}
   102  								{{end}}
   103  							</div>
   104  							{{$reactions := .Reactions.GroupByType}}
   105  							{{if $reactions}}
   106  								{{template "repo/issue/view_content/reactions" dict "ActionURL" (printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}}
   107  							{{end}}
   108  						</div>
   109  					</div>
   110  				{{end}}
   111  			</div>
   112  			<div class="code-comment-buttons tw-flex tw-items-center tw-flex-wrap tw-mt-2 tw-mb-1 tw-mx-2">
   113  				<div class="tw-flex-1">
   114  					{{if $resolved}}
   115  						<div class="ui grey text">
   116  							{{svg "octicon-check" 16 "tw-mr-1"}}
   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 tw-ml-1 tw-mr-0">
   133  							{{svg "octicon-reply" 16 "reply icon tw-mr-1"}}{{ctx.Locale.Tr "repo.diff.comment.reply"}}
   134  						</button>
   135  					{{end}}
   136  				</div>
   137  			</div>
   138  			{{template "repo/diff/comment_form_datahandler" dict "hidden" true "reply" $comment.ReviewID "root" $ "comment" $comment}}
   139  		</div>
   140  	</div>
   141  {{else}}
   142  	{{template "repo/diff/conversation_outdated"}}
   143  {{end}}