You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

conversation.tmpl 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 tw-flex tw-items-center tw-justify-between">
  12. <div class="ui grey text tw-flex tw-items-center tw-flex-wrap tw-gap-1">
  13. {{svg "octicon-check" 16 "icon tw-mr-1"}}
  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 tw-ml-2" 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="tw-flex tw-items-center tw-gap-2">
  26. <button id="show-outdated-{{$comment.ID}}" data-comment="{{$comment.ID}}" class="ui tiny labeled button show-outdated tw-flex tw-items-center">
  27. {{svg "octicon-unfold" 16 "tw-mr-2"}}
  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 tw-flex tw-items-center tw-hidden">
  31. {{svg "octicon-fold" 16 "tw-mr-2"}}
  32. {{ctx.Locale.Tr "repo.issues.review.hide_resolved"}}
  33. </button>
  34. </div>
  35. </div>
  36. {{end}}
  37. <div id="code-comments-{{$comment.ID}}" class="field comment-code-cloud {{if $resolved}}tw-hidden{{end}}">
  38. <div class="comment-list">
  39. <ui class="ui comments">
  40. {{template "repo/diff/comments" dict "root" $ "comments" .comments}}
  41. </ui>
  42. </div>
  43. <div class="tw-flex tw-justify-end tw-items-center tw-flex-wrap tw-mt-2">
  44. <div class="ui buttons tw-mr-1">
  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 tw-ml-1 tw-mr-0">
  63. {{svg "octicon-reply" 16 "reply icon tw-mr-1"}}{{ctx.Locale.Tr "repo.diff.comment.reply"}}
  64. </button>
  65. {{end}}
  66. </div>
  67. {{template "repo/diff/comment_form_datahandler" dict "hidden" true "reply" $comment.ReviewID "root" $ "comment" $comment}}
  68. </div>
  69. </div>
  70. {{else}}
  71. {{template "repo/diff/conversation_outdated"}}
  72. {{end}}