Files
gitea/templates/repo/diff/comments.tmpl
T
edd0c0e2ce feat: add release reactions and a GitHub-like reaction bar (#38415)
Adds emoji reactions to releases and moves the reaction picker of
issues, comments and releases into a GitHub-like reaction bar.

- Releases omit 👎 or 😕
- Drafts and tags can't be reacted to
- Moved menu to tippy
- Added keyboard navigation

Fixes: https://github.com/go-gitea/gitea/issues/34268
Fixes: https://github.com/go-gitea/gitea/issues/16676
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-10-20 15:04:10 +02:00

84 lines
3.7 KiB
Handlebars

{{$root := ctx.RootData -}}
{{$repo := $root.Repository -}}
{{$repoLink := $root.RepoLink -}}
{{$issue := $root.Issue -}}
{{$canWrite := or $root.Permission.IsAdmin $root.HasIssuesOrPullsWritePermission -}}
{{$signedUserID := or $root.SignedUserID NIL -}}
{{range $comment := $.comments}}
{{$createdStr:= DateUtils.TimeSince $comment.CreatedUnix}}
<div class="comment" id="{{$comment.HashTag}}">
<div class="tw-mt-2 tw-mr-4">
{{if $comment.OriginalAuthor}}
<span class="avatar">{{ctx.AvatarUtils.Avatar nil}}</span>
{{else}}
{{template "shared/user/avatarlink" dict "user" $comment.Poster}}
{{end}}
</div>
<div class="content comment-container">
<div class="comment-header avatar-content-left-arrow">
<div class="comment-header-left">
{{if $comment.OriginalAuthor}}
<span class="tw-text-text tw-font-semibold tw-mr-1">
{{svg (MigrationIcon $repo.GetOriginalURLHostname)}}
{{$comment.OriginalAuthor}}
</span>
<span class="tw-text-text-light muted-links">
{{ctx.Locale.Tr "repo.issues.commented_at" $comment.HashTag $createdStr}}
</span>
<span class="text migrate">
{{if $repo.OriginalURL}}
({{ctx.Locale.Tr "repo.migrated_from" $repo.OriginalURL $repo.GetOriginalURLHostname}})
{{end}}
</span>
{{else}}
<span class="tw-text-text-light muted-links">
{{template "shared/user/namelink" $comment.Poster}}
{{ctx.Locale.Tr "repo.issues.commented_at" $comment.HashTag $createdStr}}
</span>
{{end}}
</div>
<div class="comment-header-right">
{{if $comment.Invalidated}}
{{$referenceUrl := printf "%s#%s" $issue.Link $comment.HashTag}}
<a href="{{$referenceUrl}}" class="ui label basic small" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.review.outdated_description"}}">
{{ctx.Locale.Tr "repo.issues.review.outdated"}}
</a>
{{end}}
{{if $comment.Review}}
{{if eq $comment.Review.Type 0}}
<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")}}">
{{ctx.Locale.Tr "repo.issues.review.pending"}}
</div>
{{else}}
<div class="ui label basic small">
{{ctx.Locale.Tr "repo.issues.review.review"}}
</div>
{{end}}
{{end}}
{{template "repo/issue/view_content/context_menu" dict "ConvContentType" "issue_comment" "ConvContentPage" "pr-files" "ConvContentItem" $comment}}
</div>
</div>
<div class="ui attached segment comment-body">
{{$doerIsPoster := eq $signedUserID $comment.PosterID}}
<div class="render-content markup" {{if or $canWrite $doerIsPoster}}data-can-edit="true"{{end}}>
{{if $comment.RenderedContent}}
{{$comment.RenderedContent}}
{{else}}
<span class="no-content">{{ctx.Locale.Tr "repo.issues.no_content"}}</span>
{{end}}
</div>
<div id="{{$comment.HashTag}}-raw" class="raw-content tw-hidden">{{$comment.Content}}</div>
<div class="edit-content-zone tw-hidden" data-update-url="{{$repoLink}}/comments/{{$comment.ID}}" data-content-version="{{$comment.ContentVersion}}" data-context="{{$repoLink}}" data-attachment-url="{{$repoLink}}/comments/{{$comment.ID}}/attachments"></div>
{{if $comment.Attachments}}
{{template "repo/issue/view_content/attachments" dict "Attachments" $comment.Attachments "RenderedContent" $comment.RenderedContent}}
{{end}}
</div>
{{template "shared/reactions" dict
"AllowedReactions" $root.AllowedIssueReactions
"ActionURL" (printf "%s/comments/%d/reactions" $repoLink $comment.ID)
"Reactions" $comment.Reactions.GroupByType
}}
</div>
</div>
{{end}}