gitea源码

feeds.tmpl 8.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <div id="activity-feed" class="flex-list">
  2. {{range .Feeds}}
  3. <div class="flex-item">
  4. <div class="flex-item-leading">
  5. {{ctx.AvatarUtils.AvatarByAction .}}
  6. </div>
  7. <div class="flex-item-main tw-gap-2">
  8. <div>
  9. {{if gt .ActUser.ID 0}}
  10. <a href="{{AppSubUrl}}/{{(.GetActUserName ctx) | PathEscape}}" title="{{.GetActDisplayNameTitle ctx}}">{{.GetActDisplayName ctx}}</a>
  11. {{else}}
  12. {{.ShortActUserName ctx}}
  13. {{end}}
  14. {{if .GetOpType.InActions "create_repo"}}
  15. {{ctx.Locale.Tr "action.create_repo" (.GetRepoLink ctx) (.ShortRepoPath ctx)}}
  16. {{else if .GetOpType.InActions "rename_repo"}}
  17. {{ctx.Locale.Tr "action.rename_repo" .GetContent (.GetRepoLink ctx) (.ShortRepoPath ctx)}}
  18. {{else if .GetOpType.InActions "commit_repo"}}
  19. {{if .Content}}
  20. {{ctx.Locale.Tr "action.commit_repo" (.GetRepoLink ctx) (.GetRefLink ctx) .GetBranch (.ShortRepoPath ctx)}}
  21. {{else}}
  22. {{ctx.Locale.Tr "action.create_branch" (.GetRepoLink ctx) (.GetRefLink ctx) .GetBranch (.ShortRepoPath ctx)}}
  23. {{end}}
  24. {{else if .GetOpType.InActions "create_issue"}}
  25. {{$index := index .GetIssueInfos 0}}
  26. {{ctx.Locale.Tr "action.create_issue" (printf "%s/issues/%s" (.GetRepoLink ctx) $index) $index (.ShortRepoPath ctx)}}
  27. {{else if .GetOpType.InActions "create_pull_request"}}
  28. {{$index := index .GetIssueInfos 0}}
  29. {{ctx.Locale.Tr "action.create_pull_request" (printf "%s/pulls/%s" (.GetRepoLink ctx) $index) $index (.ShortRepoPath ctx)}}
  30. {{else if .GetOpType.InActions "transfer_repo"}}
  31. {{ctx.Locale.Tr "action.transfer_repo" .GetContent (.GetRepoLink ctx) (.ShortRepoPath ctx)}}
  32. {{else if .GetOpType.InActions "push_tag"}}
  33. {{ctx.Locale.Tr "action.push_tag" (.GetRepoLink ctx) (.GetRefLink ctx) .GetTag (.ShortRepoPath ctx)}}
  34. {{else if .GetOpType.InActions "comment_issue"}}
  35. {{$index := index .GetIssueInfos 0}}
  36. {{ctx.Locale.Tr "action.comment_issue" (printf "%s/issues/%s" (.GetRepoLink ctx) $index) $index (.ShortRepoPath ctx)}}
  37. {{else if .GetOpType.InActions "merge_pull_request"}}
  38. {{$index := index .GetIssueInfos 0}}
  39. {{ctx.Locale.Tr "action.merge_pull_request" (printf "%s/pulls/%s" (.GetRepoLink ctx) $index) $index (.ShortRepoPath ctx)}}
  40. {{else if .GetOpType.InActions "close_issue"}}
  41. {{$index := index .GetIssueInfos 0}}
  42. {{ctx.Locale.Tr "action.close_issue" (printf "%s/issues/%s" (.GetRepoLink ctx) $index) $index (.ShortRepoPath ctx)}}
  43. {{else if .GetOpType.InActions "reopen_issue"}}
  44. {{$index := index .GetIssueInfos 0}}
  45. {{ctx.Locale.Tr "action.reopen_issue" (printf "%s/issues/%s" (.GetRepoLink ctx) $index) $index (.ShortRepoPath ctx)}}
  46. {{else if .GetOpType.InActions "close_pull_request"}}
  47. {{$index := index .GetIssueInfos 0}}
  48. {{ctx.Locale.Tr "action.close_pull_request" (printf "%s/pulls/%s" (.GetRepoLink ctx) $index) $index (.ShortRepoPath ctx)}}
  49. {{else if .GetOpType.InActions "reopen_pull_request"}}
  50. {{$index := index .GetIssueInfos 0}}
  51. {{ctx.Locale.Tr "action.reopen_pull_request" (printf "%s/pulls/%s" (.GetRepoLink ctx) $index) $index (.ShortRepoPath ctx)}}
  52. {{else if .GetOpType.InActions "delete_tag"}}
  53. {{$index := index .GetIssueInfos 0}}
  54. {{ctx.Locale.Tr "action.delete_tag" (.GetRepoLink ctx) .GetTag (.ShortRepoPath ctx)}}
  55. {{else if .GetOpType.InActions "delete_branch"}}
  56. {{$index := index .GetIssueInfos 0}}
  57. {{ctx.Locale.Tr "action.delete_branch" (.GetRepoLink ctx) .GetBranch (.ShortRepoPath ctx)}}
  58. {{else if .GetOpType.InActions "mirror_sync_push"}}
  59. {{ctx.Locale.Tr "action.mirror_sync_push" (.GetRepoLink ctx) (.GetRefLink ctx) .GetBranch (.ShortRepoPath ctx)}}
  60. {{else if .GetOpType.InActions "mirror_sync_create"}}
  61. {{ctx.Locale.Tr "action.mirror_sync_create" (.GetRepoLink ctx) (.GetRefLink ctx) .GetBranch (.ShortRepoPath ctx)}}
  62. {{else if .GetOpType.InActions "mirror_sync_delete"}}
  63. {{ctx.Locale.Tr "action.mirror_sync_delete" (.GetRepoLink ctx) .GetBranch (.ShortRepoPath ctx)}}
  64. {{else if .GetOpType.InActions "approve_pull_request"}}
  65. {{$index := index .GetIssueInfos 0}}
  66. {{ctx.Locale.Tr "action.approve_pull_request" (printf "%s/pulls/%s" (.GetRepoLink ctx) $index) $index (.ShortRepoPath ctx)}}
  67. {{else if .GetOpType.InActions "reject_pull_request"}}
  68. {{$index := index .GetIssueInfos 0}}
  69. {{ctx.Locale.Tr "action.reject_pull_request" (printf "%s/pulls/%s" (.GetRepoLink ctx) $index) $index (.ShortRepoPath ctx)}}
  70. {{else if .GetOpType.InActions "comment_pull"}}
  71. {{$index := index .GetIssueInfos 0}}
  72. {{ctx.Locale.Tr "action.comment_pull" (printf "%s/pulls/%s" (.GetRepoLink ctx) $index) $index (.ShortRepoPath ctx)}}
  73. {{else if .GetOpType.InActions "publish_release"}}
  74. {{$linkText := .Content | ctx.RenderUtils.RenderEmoji}}
  75. {{ctx.Locale.Tr "action.publish_release" (.GetRepoLink ctx) (printf "%s/releases/tag/%s" (.GetRepoLink ctx) .GetTag) (.ShortRepoPath ctx) $linkText}}
  76. {{else if .GetOpType.InActions "pull_review_dismissed"}}
  77. {{$index := index .GetIssueInfos 0}}
  78. {{$reviewer := index .GetIssueInfos 1}}
  79. {{ctx.Locale.Tr "action.review_dismissed" (printf "%s/pulls/%s" (.GetRepoLink ctx) $index) $index (.ShortRepoPath ctx) $reviewer}}
  80. {{else if .GetOpType.InActions "auto_merge_pull_request"}}
  81. {{$index := index .GetIssueInfos 0}}
  82. {{ctx.Locale.Tr "action.auto_merge_pull_request" (printf "%s/pulls/%s" (.GetRepoLink ctx) $index) $index (.ShortRepoPath ctx)}}
  83. {{end}}
  84. {{DateUtils.TimeSince .GetCreate}}
  85. </div>
  86. {{if .GetOpType.InActions "commit_repo" "mirror_sync_push"}}
  87. {{$push := ActionContent2Commits .}}
  88. {{$repoLink := (.GetRepoLink ctx)}}
  89. {{$repo := .Repo}}
  90. <div class="tw-flex tw-flex-col tw-gap-1">
  91. {{range $push.Commits}}
  92. {{$commitLink := printf "%s/commit/%s" $repoLink .Sha1}}
  93. <div class="flex-text-block">
  94. <img loading="lazy" alt class="ui avatar" src="{{$push.AvatarLink ctx .AuthorEmail}}" title="{{.AuthorName}}" width="16" height="16">
  95. <a class="ui sha label" href="{{$commitLink}}">{{ShortSha .Sha1}}</a>
  96. <span class="text truncate">
  97. {{ctx.RenderUtils.RenderCommitMessage .Message $repo}}
  98. </span>
  99. </div>
  100. {{end}}
  101. </div>
  102. {{if and (gt $push.Len 1) $push.CompareURL}}
  103. <a href="{{AppSubUrl}}/{{$push.CompareURL}}">{{ctx.Locale.Tr "action.compare_commits" $push.Len}} »</a>
  104. {{end}}
  105. {{else if .GetOpType.InActions "create_issue"}}
  106. <span class="text truncate issue title">{{index .GetIssueInfos 1 | ctx.RenderUtils.RenderIssueSimpleTitle}}</span>
  107. {{else if .GetOpType.InActions "create_pull_request"}}
  108. <span class="text truncate issue title">{{index .GetIssueInfos 1 | ctx.RenderUtils.RenderIssueSimpleTitle}}</span>
  109. {{else if .GetOpType.InActions "comment_issue" "approve_pull_request" "reject_pull_request" "comment_pull"}}
  110. <a href="{{.GetCommentLink ctx}}" class="text truncate issue title">{{(.GetIssueTitle ctx) | ctx.RenderUtils.RenderIssueSimpleTitle}}</a>
  111. {{$comment := index .GetIssueInfos 1}}
  112. {{if $comment}}
  113. <div class="render-content markup tw-text-14">{{ctx.RenderUtils.MarkdownToHtml $comment}}</div>
  114. {{end}}
  115. {{else if .GetOpType.InActions "merge_pull_request"}}
  116. <div class="flex-item-body text black">{{index .GetIssueInfos 1}}</div>
  117. {{else if .GetOpType.InActions "close_issue" "reopen_issue" "close_pull_request" "reopen_pull_request"}}
  118. <span class="text truncate issue title">{{(.GetIssueTitle ctx) | ctx.RenderUtils.RenderIssueSimpleTitle}}</span>
  119. {{else if .GetOpType.InActions "pull_review_dismissed"}}
  120. <div class="flex-item-body text black">{{ctx.Locale.Tr "action.review_dismissed_reason"}}</div>
  121. <div class="flex-item-body text black">{{index .GetIssueInfos 2 | ctx.RenderUtils.RenderEmoji}}</div>
  122. {{end}}
  123. </div>
  124. <div class="flex-item-trailing">
  125. {{svg (printf "octicon-%s" (ActionIcon .GetOpType)) 32 "text grey tw-mr-1"}}
  126. </div>
  127. </div>
  128. {{end}}
  129. {{template "base/paginate" .}}
  130. </div>