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.

comments.tmpl 36KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837
  1. {{ template "base/alert" }}
  2. {{range .Issue.Comments}}
  3. {{if call $.ShouldShowCommentType .Type}}
  4. {{ $createdStr:= TimeSinceUnix .CreatedUnix $.i18n.Lang }}
  5. <!-- 0 = COMMENT, 1 = REOPEN, 2 = CLOSE, 3 = ISSUE_REF, 4 = COMMIT_REF,
  6. 5 = COMMENT_REF, 6 = PULL_REF, 7 = COMMENT_LABEL, 12 = START_TRACKING,
  7. 13 = STOP_TRACKING, 14 = ADD_TIME_MANUAL, 16 = ADDED_DEADLINE, 17 = MODIFIED_DEADLINE,
  8. 18 = REMOVED_DEADLINE, 19 = ADD_DEPENDENCY, 20 = REMOVE_DEPENDENCY, 21 = CODE,
  9. 22 = REVIEW, 23 = ISSUE_LOCKED, 24 = ISSUE_UNLOCKED, 25 = TARGET_BRANCH_CHANGED,
  10. 26 = DELETE_TIME_MANUAL, 27 = REVIEW_REQUEST, 28 = MERGE_PULL_REQUEST,
  11. 29 = PULL_PUSH_EVENT, 30 = PROJECT_CHANGED, 31 = PROJECT_BOARD_CHANGED
  12. 32 = DISMISSED_REVIEW -->
  13. {{if eq .Type 0}}
  14. <div class="timeline-item comment" id="{{.HashTag}}">
  15. {{if .OriginalAuthor }}
  16. <span class="timeline-avatar"><img src="{{AppSubUrl}}/assets/img/avatar_default.png"></span>
  17. {{else}}
  18. <a class="timeline-avatar" {{if gt .Poster.ID 0}}href="{{.Poster.HomeLink}}"{{end}}>
  19. {{avatar .Poster}}
  20. </a>
  21. {{end}}
  22. <div class="content comment-container">
  23. <div class="ui top attached header comment-header df ac sb">
  24. <div class="comment-header-left df ac">
  25. {{if .OriginalAuthor }}
  26. <span class="text black mr-2">
  27. {{svg (MigrationIcon $.Repository.GetOriginalURLHostname)}}
  28. {{ .OriginalAuthor }}
  29. </span>
  30. <span class="text grey">
  31. {{$.i18n.Tr "repo.issues.commented_at" (.HashTag|Escape) $createdStr | Safe}} {{if $.Repository.OriginalURL}}
  32. </span>
  33. <span class="text migrate">
  34. ({{$.i18n.Tr "repo.migrated_from" ($.Repository.OriginalURL|Escape) ($.Repository.GetOriginalURLHostname|Escape) | Safe }}){{end}}
  35. </span>
  36. {{else}}
  37. <span class="text grey">
  38. <a class="author"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>
  39. {{.Poster.GetDisplayName}}
  40. </a>
  41. {{$.i18n.Tr "repo.issues.commented_at" (.HashTag|Escape) $createdStr | Safe}}
  42. </span>
  43. {{end}}
  44. </div>
  45. <div class="comment-header-right actions df ac">
  46. {{if (.ShowRole.HasRole "Poster")}}
  47. <div class="ui basic label">
  48. {{$.i18n.Tr "repo.issues.poster"}}
  49. </div>
  50. {{end}}
  51. {{if (.ShowRole.HasRole "Writer")}}
  52. <div class="ui basic label">
  53. {{$.i18n.Tr "repo.issues.collaborator"}}
  54. </div>
  55. {{end}}
  56. {{if (.ShowRole.HasRole "Owner")}}
  57. <div class="ui basic label">
  58. {{$.i18n.Tr "repo.issues.owner"}}
  59. </div>
  60. {{end}}
  61. {{if not $.Repository.IsArchived}}
  62. {{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID)}}
  63. {{template "repo/issue/view_content/context_menu" Dict "ctx" $ "item" . "delete" true "issue" true "diff" false "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}}
  64. {{end}}
  65. </div>
  66. </div>
  67. <div class="ui attached segment comment-body">
  68. <div class="render-content markup" {{if or $.Permission.IsAdmin $.HasIssuesOrPullsWritePermission (and $.IsSigned (eq $.SignedUserID .PosterID))}}data-can-edit="true"{{end}}>
  69. {{if .RenderedContent}}
  70. {{.RenderedContent|Str2html}}
  71. {{else}}
  72. <span class="no-content">{{$.i18n.Tr "repo.issues.no_content"}}</span>
  73. {{end}}
  74. </div>
  75. <div id="comment-{{.ID}}" class="raw-content hide">{{.Content}}</div>
  76. <div class="edit-content-zone hide" data-write="issuecomment-{{.ID}}-write" data-preview="issuecomment-{{.ID}}-preview" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div>
  77. {{if .Attachments}}
  78. {{template "repo/issue/view_content/attachments" Dict "ctx" $ "Attachments" .Attachments "Content" .RenderedContent}}
  79. {{end}}
  80. </div>
  81. {{$reactions := .Reactions.GroupByType}}
  82. {{if $reactions}}
  83. <div class="ui attached segment reactions">
  84. {{template "repo/issue/view_content/reactions" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}}
  85. </div>
  86. {{end}}
  87. </div>
  88. </div>
  89. {{else if eq .Type 1}}
  90. <div class="timeline-item event" id="{{.HashTag}}">
  91. <span class="badge bg-green text-white">{{svg "octicon-dot-fill"}}</span>
  92. <a href="{{.Poster.HomeLink}}">
  93. {{avatar .Poster}}
  94. </a>
  95. <span class="text grey">
  96. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  97. {{if .Issue.IsPull }}
  98. {{$.i18n.Tr "repo.pulls.reopened_at" .EventTag $createdStr | Safe}}
  99. {{else}}
  100. {{$.i18n.Tr "repo.issues.reopened_at" .EventTag $createdStr | Safe}}
  101. {{end}}
  102. </span>
  103. </div>
  104. {{else if eq .Type 2}}
  105. <div class="timeline-item event" id="{{.HashTag}}">
  106. <span class="badge bg-red text-white">{{svg "octicon-circle-slash"}}</span>
  107. <a href="{{.Poster.HomeLink}}">
  108. {{avatar .Poster}}
  109. </a>
  110. <span class="text grey">
  111. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  112. {{if .Issue.IsPull }}
  113. {{$.i18n.Tr "repo.pulls.closed_at" .EventTag $createdStr | Safe}}
  114. {{else}}
  115. {{$.i18n.Tr "repo.issues.closed_at" .EventTag $createdStr | Safe}}
  116. {{end}}
  117. </span>
  118. </div>
  119. {{else if eq .Type 28}}
  120. <div class="timeline-item event" id="{{.HashTag}}">
  121. <span class="badge bg-purple text-white">{{svg "octicon-git-merge"}}</span>
  122. <a href="{{.Poster.HomeLink}}">
  123. {{avatar .Poster}}
  124. </a>
  125. <span class="text grey">
  126. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  127. {{$link := printf "%s/commit/%s" $.Repository.HTMLURL ($.Issue.PullRequest.MergedCommitID|PathEscape)}}
  128. {{if eq $.Issue.PullRequest.Status 3}}
  129. {{$.i18n.Tr "repo.issues.manually_pull_merged_at" ($link|Escape) (ShortSha $.Issue.PullRequest.MergedCommitID) ($.BaseTarget|Escape) $createdStr | Str2html}}
  130. {{else}}
  131. {{$.i18n.Tr "repo.issues.pull_merged_at" ($link|Escape) (ShortSha $.Issue.PullRequest.MergedCommitID) ($.BaseTarget|Escape) $createdStr | Str2html}}
  132. {{end}}
  133. </span>
  134. </div>
  135. {{else if eq .Type 3 5 6}}
  136. {{ $refFrom:= "" }}
  137. {{if ne .RefRepoID .Issue.RepoID}}
  138. {{ $refFrom = $.i18n.Tr "repo.issues.ref_from" (.RefRepo.FullName|Escape) }}
  139. {{end}}
  140. {{ $refTr := "repo.issues.ref_issue_from" }}
  141. {{if .Issue.IsPull}}
  142. {{ $refTr = "repo.issues.ref_pull_from" }}
  143. {{else if eq .RefAction 1 }}
  144. {{ $refTr = "repo.issues.ref_closing_from" }}
  145. {{else if eq .RefAction 2 }}
  146. {{ $refTr = "repo.issues.ref_reopening_from" }}
  147. {{end}}
  148. {{ $createdStr:= TimeSinceUnix .CreatedUnix $.i18n.Lang }}
  149. <div class="timeline-item event" id="{{.HashTag}}">
  150. <span class="badge">{{svg "octicon-bookmark"}}</span>
  151. <a href="{{.Poster.HomeLink}}">
  152. {{avatar .Poster}}
  153. </a>
  154. {{if eq .RefAction 3}}<del>{{end}}
  155. <span class="text grey">
  156. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  157. {{$.i18n.Tr $refTr (.EventTag|Escape) $createdStr (.RefCommentHTMLURL|Escape) $refFrom | Safe}}
  158. </span>
  159. {{if eq .RefAction 3}}</del>{{end}}
  160. <div class="detail">
  161. <span class="text grey"><a href="{{.RefIssueHTMLURL}}"><b>{{.RefIssueTitle}}</b> {{.RefIssueIdent}}</a></span>
  162. </div>
  163. </div>
  164. {{else if eq .Type 4}}
  165. <div class="timeline-item event" id="{{.HashTag}}">
  166. <span class="badge">{{svg "octicon-bookmark"}}</span>
  167. <a href="{{.Poster.HomeLink}}">
  168. {{avatar .Poster}}
  169. </a>
  170. <span class="text grey">
  171. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  172. {{$.i18n.Tr "repo.issues.commit_ref_at" .EventTag $createdStr | Safe}}
  173. </span>
  174. <div class="detail">
  175. {{svg "octicon-git-commit"}}
  176. <span class="text grey">{{.Content | Str2html}}</span>
  177. </div>
  178. </div>
  179. {{else if eq .Type 7}}
  180. {{if or .AddedLabels .RemovedLabels}}
  181. <div class="timeline-item event" id="{{.HashTag}}">
  182. <span class="badge">{{svg "octicon-tag"}}</span>
  183. <a href="{{.Poster.HomeLink}}">
  184. {{avatar .Poster}}
  185. </a>
  186. <span class="text grey">
  187. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  188. {{if and .AddedLabels (not .RemovedLabels)}}
  189. {{$.i18n.TrN (len .AddedLabels) "repo.issues.add_label" "repo.issues.add_labels" (RenderLabels .AddedLabels) $createdStr | Safe}}
  190. {{else if and (not .AddedLabels) .RemovedLabels}}
  191. {{$.i18n.TrN (len .RemovedLabels) "repo.issues.remove_label" "repo.issues.remove_labels" (RenderLabels .RemovedLabels) $createdStr | Safe}}
  192. {{else}}
  193. {{$.i18n.Tr "repo.issues.add_remove_labels" (RenderLabels .AddedLabels) (RenderLabels .RemovedLabels) $createdStr | Safe}}
  194. {{end}}
  195. </span>
  196. </div>
  197. {{end}}
  198. {{else if eq .Type 8}}
  199. <div class="timeline-item event" id="{{.HashTag}}">
  200. <span class="badge">{{svg "octicon-milestone"}}</span>
  201. <a href="{{.Poster.HomeLink}}">
  202. {{avatar .Poster}}
  203. </a>
  204. <span class="text grey">
  205. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  206. {{if gt .OldMilestoneID 0}}{{if gt .MilestoneID 0}}{{$.i18n.Tr "repo.issues.change_milestone_at" (.OldMilestone.Name|Escape) (.Milestone.Name|Escape) $createdStr | Safe}}{{else}}{{$.i18n.Tr "repo.issues.remove_milestone_at" (.OldMilestone.Name|Escape) $createdStr | Safe}}{{end}}{{else if gt .MilestoneID 0}}{{$.i18n.Tr "repo.issues.add_milestone_at" (.Milestone.Name|Escape) $createdStr | Safe}}{{end}}
  207. </span>
  208. </div>
  209. {{else if eq .Type 9}}
  210. <div class="timeline-item event" id="{{.HashTag}}">
  211. <span class="badge">{{svg "octicon-person"}}</span>
  212. {{if gt .AssigneeID 0}}
  213. {{if .RemovedAssignee}}
  214. <a href="{{.Assignee.HomeLink}}">
  215. {{avatar .Assignee}}
  216. </a>
  217. <span class="text grey">
  218. <a class="author" href="{{.Assignee.HomeLink}}">{{.Assignee.GetDisplayName}}</a>
  219. {{ if eq .Poster.ID .Assignee.ID }}
  220. {{$.i18n.Tr "repo.issues.remove_self_assignment" $createdStr | Safe}}
  221. {{ else }}
  222. {{$.i18n.Tr "repo.issues.remove_assignee_at" (.Poster.GetDisplayName|Escape) $createdStr | Safe}}
  223. {{ end }}
  224. </span>
  225. {{else}}
  226. <a href="{{.Assignee.HomeLink}}">
  227. {{avatar .Assignee}}
  228. </a>
  229. <span class="text grey">
  230. <a class="author" href="{{.Assignee.HomeLink}}">{{.Assignee.GetDisplayName}}</a>
  231. {{if eq .Poster.ID .AssigneeID}}
  232. {{$.i18n.Tr "repo.issues.self_assign_at" $createdStr | Safe}}
  233. {{else}}
  234. {{$.i18n.Tr "repo.issues.add_assignee_at" (.Poster.GetDisplayName|Escape) $createdStr | Safe}}
  235. {{end}}
  236. </span>
  237. {{end}}
  238. {{end}}
  239. </div>
  240. {{else if eq .Type 10}}
  241. <div class="timeline-item event" id="{{.HashTag}}">
  242. <span class="badge">{{svg "octicon-pencil"}}</span>
  243. <a href="{{.Poster.HomeLink}}">
  244. {{avatar .Poster}}
  245. </a>
  246. <span class="text grey">
  247. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  248. {{$.i18n.Tr "repo.issues.change_title_at" (.OldTitle|RenderEmoji) (.NewTitle|RenderEmoji) $createdStr | Safe}}
  249. </span>
  250. </div>
  251. {{else if eq .Type 11}}
  252. <div class="timeline-item event" id="{{.HashTag}}">
  253. <span class="badge">{{svg "octicon-git-branch"}}</span>
  254. <a href="{{.Poster.HomeLink}}">
  255. {{avatar .Poster}}
  256. </a>
  257. <span class="text grey">
  258. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  259. {{$.i18n.Tr "repo.issues.delete_branch_at" (.OldRef|Escape) $createdStr | Safe}}
  260. </span>
  261. </div>
  262. {{else if eq .Type 12}}
  263. <div class="timeline-item event" id="{{.HashTag}}">
  264. <span class="badge">{{svg "octicon-clock"}}</span>
  265. <a href="{{.Poster.HomeLink}}">
  266. {{avatar .Poster}}
  267. </a>
  268. <span class="text grey">
  269. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  270. {{$.i18n.Tr "repo.issues.start_tracking_history" $createdStr | Safe}}
  271. </span>
  272. </div>
  273. {{else if eq .Type 13}}
  274. <div class="timeline-item event" id="{{.HashTag}}">
  275. <span class="badge">{{svg "octicon-clock"}}</span>
  276. <a href="{{.Poster.HomeLink}}">
  277. {{avatar .Poster}}
  278. </a>
  279. <span class="text grey">
  280. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  281. {{$.i18n.Tr "repo.issues.stop_tracking_history" $createdStr | Safe}}
  282. </span>
  283. {{ template "repo/issue/view_content/comments_delete_time" Dict "ctx" $ "comment" . }}
  284. <div class="detail">
  285. {{svg "octicon-clock"}}
  286. <span class="text grey">{{.Content}}</span>
  287. </div>
  288. </div>
  289. {{else if eq .Type 14}}
  290. <div class="timeline-item event" id="{{.HashTag}}">
  291. <span class="badge">{{svg "octicon-clock"}}</span>
  292. <a href="{{.Poster.HomeLink}}">
  293. {{avatar .Poster}}
  294. </a>
  295. <span class="text grey">
  296. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  297. {{$.i18n.Tr "repo.issues.add_time_history" $createdStr | Safe}}
  298. </span>
  299. {{ template "repo/issue/view_content/comments_delete_time" Dict "ctx" $ "comment" . }}
  300. <div class="detail">
  301. {{svg "octicon-clock"}}
  302. <span class="text grey">{{.Content}}</span>
  303. </div>
  304. </div>
  305. {{else if eq .Type 15}}
  306. <div class="timeline-item event" id="{{.HashTag}}">
  307. <span class="badge">{{svg "octicon-clock"}}</span>
  308. <a href="{{.Poster.HomeLink}}">
  309. {{avatar .Poster}}
  310. </a>
  311. <span class="text grey">
  312. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  313. {{$.i18n.Tr "repo.issues.cancel_tracking_history" $createdStr | Safe}}
  314. </span>
  315. </div>
  316. {{else if eq .Type 16}}
  317. <div class="timeline-item event" id="{{.HashTag}}">
  318. <span class="badge">{{svg "octicon-clock"}}</span>
  319. <a href="{{.Poster.HomeLink}}">
  320. {{avatar .Poster}}
  321. </a>
  322. <span class="text grey">
  323. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  324. {{$.i18n.Tr "repo.issues.due_date_added" .Content $createdStr | Safe}}
  325. </span>
  326. </div>
  327. {{else if eq .Type 17}}
  328. <div class="timeline-item event" id="{{.HashTag}}">
  329. <span class="badge">{{svg "octicon-clock"}}</span>
  330. <a href="{{.Poster.HomeLink}}">
  331. {{avatar .Poster}}
  332. </a>
  333. <span class="text grey">
  334. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  335. {{$.i18n.Tr "repo.issues.due_date_modified" (.Content | ParseDeadline) $createdStr | Safe}}
  336. </span>
  337. </div>
  338. {{else if eq .Type 18}}
  339. <div class="timeline-item event" id="{{.HashTag}}">
  340. <span class="badge">{{svg "octicon-clock"}}</span>
  341. <a href="{{.Poster.HomeLink}}">
  342. {{avatar .Poster}}
  343. </a>
  344. <span class="text grey">
  345. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  346. {{$.i18n.Tr "repo.issues.due_date_remove" .Content $createdStr | Safe}}
  347. </span>
  348. </div>
  349. {{else if eq .Type 19}}
  350. <div class="timeline-item event" id="{{.HashTag}}">
  351. <span class="badge">{{svg "octicon-package-dependents"}}</span>
  352. <a href="{{.Poster.HomeLink}}">
  353. {{avatar .Poster}}
  354. </a>
  355. <span class="text grey">
  356. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  357. {{$.i18n.Tr "repo.issues.dependency.added_dependency" $createdStr | Safe}}
  358. </span>
  359. {{if .DependentIssue}}
  360. <div class="detail">
  361. {{svg "octicon-plus"}}
  362. <span class="text grey">
  363. <a href="{{.DependentIssue.HTMLURL}}">
  364. {{if eq .DependentIssue.RepoID .Issue.RepoID}}
  365. #{{.DependentIssue.Index}} {{.DependentIssue.Title}}
  366. {{else}}
  367. {{.DependentIssue.Repo.FullName}}#{{.DependentIssue.Index}} - {{.DependentIssue.Title}}
  368. {{end}}
  369. </a>
  370. </span>
  371. </div>
  372. {{end}}
  373. </div>
  374. {{else if eq .Type 20}}
  375. <div class="timeline-item event" id="{{.HashTag}}">
  376. <span class="badge">{{svg "octicon-package-dependents"}}</span>
  377. <a href="{{.Poster.HomeLink}}">
  378. {{avatar .Poster}}
  379. </a>
  380. <span class="text grey">
  381. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  382. {{$.i18n.Tr "repo.issues.dependency.removed_dependency" $createdStr | Safe}}
  383. </span>
  384. {{if .DependentIssue}}
  385. <div class="detail">
  386. <span class="text grey">{{svg "octicon-trash"}}</span>
  387. <span class="text grey">
  388. <a href="{{.DependentIssue.HTMLURL}}">
  389. {{if eq .DependentIssue.RepoID .Issue.RepoID}}
  390. #{{.DependentIssue.Index}} {{.DependentIssue.Title}}
  391. {{else}}
  392. {{.DependentIssue.Repo.FullName}}#{{.DependentIssue.Index}} - {{.DependentIssue.Title}}
  393. {{end}}
  394. </a>
  395. </span>
  396. </div>
  397. {{end}}
  398. </div>
  399. {{else if eq .Type 22}}
  400. <div class="timeline-item-group">
  401. <div class="timeline-item event">
  402. {{if .OriginalAuthor }}
  403. {{else}}
  404. <a class="timeline-avatar"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>
  405. {{avatar .Poster}}
  406. </a>
  407. {{end}}
  408. <span class="badge{{if eq .Review.Type 1}} bg-green text-white{{else if eq .Review.Type 3}} bg-red text-white{{end}}">{{svg (printf "octicon-%s" .Review.Type.Icon)}}</span>
  409. <span class="text grey">
  410. {{if .OriginalAuthor }}
  411. <span class="text black">
  412. {{svg (MigrationIcon $.Repository.GetOriginalURLHostname)}}
  413. {{ .OriginalAuthor }}
  414. </span>
  415. <span class="text grey"> {{if $.Repository.OriginalURL}}</span>
  416. <span class="text migrate">({{$.i18n.Tr "repo.migrated_from" ($.Repository.OriginalURL|Escape) ($.Repository.GetOriginalURLHostname|Escape) | Safe }}){{end}}</span>
  417. {{else}}
  418. <a class="author"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>{{.Poster.GetDisplayName}}</a>
  419. {{end}}
  420. {{if eq .Review.Type 1}}
  421. {{$.i18n.Tr "repo.issues.review.approve" $createdStr | Safe}}
  422. {{else if eq .Review.Type 2}}
  423. {{$.i18n.Tr "repo.issues.review.comment" $createdStr | Safe}}
  424. {{else if eq .Review.Type 3}}
  425. {{$.i18n.Tr "repo.issues.review.reject" $createdStr | Safe}}
  426. {{else}}
  427. {{$.i18n.Tr "repo.issues.review.comment" $createdStr | Safe}}
  428. {{end}}
  429. {{if .Review.Dismissed}}
  430. <div class="ui small label">{{$.i18n.Tr "repo.issues.review.dismissed_label"}}</div>
  431. {{end}}
  432. </span>
  433. </div>
  434. {{if .Content}}
  435. <div class="timeline-item comment" id="{{.HashTag}}">
  436. <div class="content comment-container">
  437. <div class="ui top attached header comment-header df ac sb">
  438. <div class="comment-header-left df ac">
  439. <span class="text grey">
  440. {{if .OriginalAuthor }}
  441. <span class="text black">
  442. {{svg (MigrationIcon $.Repository.GetOriginalURLHostname)}}
  443. {{ .OriginalAuthor }}
  444. </span>
  445. <span class="text grey"> {{if $.Repository.OriginalURL}}</span>
  446. <span class="text migrate">({{$.i18n.Tr "repo.migrated_from" ($.Repository.OriginalURL|Escape) ($.Repository.GetOriginalURLHostname|Escape) | Safe }}){{end}}</span>
  447. {{else}}
  448. <a class="author"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>{{.Poster.GetDisplayName}}</a>
  449. {{end}}
  450. {{$.i18n.Tr "repo.issues.review.left_comment" | Safe}}
  451. </span>
  452. </div>
  453. <div class="comment-header-right actions df ac">
  454. {{if (.ShowRole.HasRole "Poster")}}
  455. <div class="ui basic label">
  456. {{$.i18n.Tr "repo.issues.poster"}}
  457. </div>
  458. {{end}}
  459. {{if (.ShowRole.HasRole "Writer")}}
  460. <div class="ui basic label">
  461. {{$.i18n.Tr "repo.issues.collaborator"}}
  462. </div>
  463. {{end}}
  464. {{if (.ShowRole.HasRole "Owner")}}
  465. <div class="ui basic label">
  466. {{$.i18n.Tr "repo.issues.owner"}}
  467. </div>
  468. {{end}}
  469. {{if not $.Repository.IsArchived}}
  470. {{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID)}}
  471. {{template "repo/issue/view_content/context_menu" Dict "ctx" $ "item" . "delete" true "issue" true "diff" false "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}}
  472. {{end}}
  473. </div>
  474. </div>
  475. <div class="ui attached segment comment-body">
  476. <div class="render-content markup">
  477. {{if .RenderedContent}}
  478. {{.RenderedContent|Str2html}}
  479. {{else}}
  480. <span class="no-content">{{$.i18n.Tr "repo.issues.no_content"}}</span>
  481. {{end}}
  482. </div>
  483. <div id="comment-{{.ID}}" class="raw-content hide">{{.Content}}</div>
  484. <div class="edit-content-zone hide" data-write="issuecomment-{{.ID}}-write" data-preview="issuecomment-{{.ID}}-preview" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div>
  485. {{if .Attachments}}
  486. {{template "repo/issue/view_content/attachments" Dict "ctx" $ "Attachments" .Attachments "Content" .RenderedContent}}
  487. {{end}}
  488. </div>
  489. {{$reactions := .Reactions.GroupByType}}
  490. {{if $reactions}}
  491. <div class="ui attached segment reactions">
  492. {{template "repo/issue/view_content/reactions" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}}
  493. </div>
  494. {{end}}
  495. </div>
  496. </div>
  497. {{end}}
  498. {{if .Review.CodeComments}}
  499. <div class="timeline-item event">
  500. {{ range $filename, $lines := .Review.CodeComments}}
  501. {{range $line, $comms := $lines}}
  502. <div class="ui segments">
  503. <div class="ui segment py-3 df ac sb word-break">
  504. {{$invalid := (index $comms 0).Invalidated}}
  505. {{$resolved := (index $comms 0).IsResolved}}
  506. {{$resolveDoer := (index $comms 0).ResolveDoer}}
  507. {{$isNotPending := (not (eq (index $comms 0).Review.Type 0))}}
  508. <div class="df ac">
  509. <a href="{{(index $comms 0).CodeCommentURL}}" class="file-comment ml-3">{{$filename}}</a>
  510. {{if $invalid }}
  511. <span class="ui label basic small ml-3">
  512. {{$.i18n.Tr "repo.issues.review.outdated"}}
  513. </span>
  514. {{end}}
  515. </div>
  516. <div>
  517. {{if or $invalid $resolved}}
  518. <button id="show-outdated-{{(index $comms 0).ID}}" data-comment="{{(index $comms 0).ID}}" class="{{if not $resolved}}hide {{end}}ui compact right labeled button show-outdated df ac">
  519. {{svg "octicon-unfold" 16 "mr-3"}}
  520. {{if $resolved}}
  521. {{$.i18n.Tr "repo.issues.review.show_resolved"}}
  522. {{else}}
  523. {{$.i18n.Tr "repo.issues.review.show_outdated"}}
  524. {{end}}
  525. </button>
  526. <button id="hide-outdated-{{(index $comms 0).ID}}" data-comment="{{(index $comms 0).ID}}" class="{{if $resolved}}hide {{end}}ui compact right labeled button hide-outdated df ac">
  527. {{svg "octicon-fold" 16 "mr-3"}}
  528. {{if $resolved}}
  529. {{$.i18n.Tr "repo.issues.review.hide_resolved"}}
  530. {{else}}
  531. {{$.i18n.Tr "repo.issues.review.hide_outdated"}}
  532. {{end}}
  533. </button>
  534. {{end}}
  535. </div>
  536. </div>
  537. {{$diff := (CommentMustAsDiff (index $comms 0))}}
  538. {{if $diff}}
  539. {{$file := (index $diff.Files 0)}}
  540. <div id="code-preview-{{(index $comms 0).ID}}" class="ui table segment{{if $resolved}} hide{{end}}">
  541. <div class="diff-file-box diff-box file-content {{TabSizeClass $.Editorconfig $file.Name}}">
  542. <div class="file-body file-code code-view code-diff code-diff-unified unicode-escaped">
  543. <table>
  544. <tbody>
  545. {{template "repo/diff/section_unified" dict "file" $file "root" $}}
  546. </tbody>
  547. </table>
  548. </div>
  549. </div>
  550. </div>
  551. {{end}}
  552. <div id="code-comments-{{(index $comms 0).ID}}" class="comment-code-cloud ui segment{{if $resolved}} hide{{end}}">
  553. <div class="ui comments mb-0">
  554. {{range $comms}}
  555. {{ $createdSubStr:= TimeSinceUnix .CreatedUnix $.i18n.Lang }}
  556. <div class="comment code-comment pb-4" id="{{.HashTag}}">
  557. <div class="content">
  558. <div class="header comment-header">
  559. <div class="comment-header-left df ac">
  560. {{if not .OriginalAuthor }}
  561. <a class="avatar">
  562. {{avatar .Poster}}
  563. </a>
  564. {{end}}
  565. <span class="text grey">
  566. {{if .OriginalAuthor }}
  567. <span class="text black">
  568. {{svg (MigrationIcon $.Repository.GetOriginalURLHostname)}}
  569. {{ .OriginalAuthor }}
  570. </span>
  571. <span class="text grey"> {{if $.Repository.OriginalURL}}</span>
  572. <span class="text migrate">({{$.i18n.Tr "repo.migrated_from" ($.Repository.OriginalURL|Escape) ($.Repository.GetOriginalURLHostname|Escape) | Safe }}){{end}}</span>
  573. {{else}}
  574. <a class="author"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>{{.Poster.GetDisplayName}}</a>
  575. {{end}}
  576. {{$.i18n.Tr "repo.issues.commented_at" (.HashTag|Escape) $createdSubStr | Safe}}
  577. </span>
  578. </div>
  579. <div class="comment-header-right actions df ac">
  580. {{if (.ShowRole.HasRole "Poster")}}
  581. <div class="ui basic label">
  582. {{$.i18n.Tr "repo.issues.poster"}}
  583. </div>
  584. {{end}}
  585. {{if (.ShowRole.HasRole "Writer")}}
  586. <div class="ui basic label">
  587. {{$.i18n.Tr "repo.issues.collaborator"}}
  588. </div>
  589. {{end}}
  590. {{if (.ShowRole.HasRole "Owner")}}
  591. <div class="ui basic label">
  592. {{$.i18n.Tr "repo.issues.owner"}}
  593. </div>
  594. {{end}}
  595. {{if not $.Repository.IsArchived}}
  596. {{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID)}}
  597. {{template "repo/issue/view_content/context_menu" Dict "ctx" $ "item" . "delete" true "issue" true "diff" true "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}}
  598. {{end}}
  599. </div>
  600. </div>
  601. <div class="text comment-content">
  602. <div class="render-content markup" {{if or $.Permission.IsAdmin $.HasIssuesOrPullsWritePermission (and $.IsSigned (eq $.SignedUserID .PosterID))}}data-can-edit="true"{{end}}>
  603. {{if .RenderedContent}}
  604. {{.RenderedContent|Str2html}}
  605. {{else}}
  606. <span class="no-content">{{$.i18n.Tr "repo.issues.no_content"}}</span>
  607. {{end}}
  608. </div>
  609. <div id="comment-{{.ID}}" class="raw-content hide">{{.Content}}</div>
  610. <div class="edit-content-zone hide" data-write="issuecomment-{{.ID}}-write" data-preview="issuecomment-{{.ID}}-preview" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div>
  611. </div>
  612. {{$reactions := .Reactions.GroupByType}}
  613. {{if $reactions}}
  614. <div class="ui attached segment reactions">
  615. {{template "repo/issue/view_content/reactions" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}}
  616. </div>
  617. {{end}}
  618. </div>
  619. </div>
  620. {{end}}
  621. </div>
  622. <div class="code-comment-buttons df ac fw mt-3 mb-2 mx-3">
  623. <div class="f1">
  624. {{if $resolved}}
  625. <div class="ui grey text">
  626. {{svg "octicon-check" 16 "mr-2"}}
  627. <b>{{$resolveDoer.Name}}</b> {{$.i18n.Tr "repo.issues.review.resolved_by"}}
  628. </div>
  629. {{end}}
  630. </div>
  631. <div class="code-comment-buttons-buttons">
  632. {{if and $.CanMarkConversation $isNotPending}}
  633. <button class="ui tiny basic button resolve-conversation" data-origin="timeline" data-action="{{if not $resolved}}Resolve{{else}}UnResolve{{end}}" data-comment-id="{{(index $comms 0).ID}}" data-update-url="{{$.RepoLink}}/issues/resolve_conversation">
  634. {{if $resolved}}
  635. {{$.i18n.Tr "repo.issues.review.un_resolve_conversation"}}
  636. {{else}}
  637. {{$.i18n.Tr "repo.issues.review.resolve_conversation"}}
  638. {{end}}
  639. </button>
  640. {{end}}
  641. {{if and $.SignedUserID (not $.Repository.IsArchived)}}
  642. <button class="comment-form-reply ui green tiny labeled icon button ml-2 mr-0">
  643. {{svg "octicon-reply" 16 "reply icon mr-2"}}{{$.i18n.Tr "repo.diff.comment.reply"}}
  644. </button>
  645. {{end}}
  646. </div>
  647. </div>
  648. {{template "repo/diff/comment_form_datahandler" dict "hidden" true "reply" (index $comms 0).ReviewID "root" $ "comment" (index $comms 0)}}
  649. </div>
  650. </div>
  651. {{end}}
  652. {{end}}
  653. </div>
  654. {{end}}
  655. </div>
  656. {{else if eq .Type 23}}
  657. <div class="timeline-item event" id="{{.HashTag}}">
  658. <span class="badge">{{svg "octicon-lock"}}</span>
  659. <a href="{{.Poster.HomeLink}}">
  660. {{avatar .Poster}}
  661. </a>
  662. {{ if .Content }}
  663. <span class="text grey">
  664. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  665. {{$.i18n.Tr "repo.issues.lock_with_reason" .Content $createdStr | Safe}}
  666. </span>
  667. {{ else }}
  668. <span class="text grey">
  669. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  670. {{$.i18n.Tr "repo.issues.lock_no_reason" $createdStr | Safe}}
  671. </span>
  672. {{ end }}
  673. </div>
  674. {{else if eq .Type 24}}
  675. <div class="timeline-item event" id="{{.HashTag}}">
  676. <span class="badge">{{svg "octicon-key"}}</span>
  677. <a href="{{.Poster.HomeLink}}">
  678. {{avatar .Poster}}
  679. </a>
  680. <span class="text grey">
  681. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  682. {{$.i18n.Tr "repo.issues.unlock_comment" $createdStr | Safe}}
  683. </span>
  684. </div>
  685. {{else if eq .Type 25}}
  686. <div class="timeline-item event">
  687. <span class="badge">{{svg "octicon-git-branch"}}</span>
  688. <a href="{{.Poster.HomeLink}}">
  689. {{avatar .Poster}}
  690. </a>
  691. <span class="text grey">
  692. <a href="{{.Poster.HomeLink}}">{{.Poster.Name}}</a>
  693. {{$.i18n.Tr "repo.pulls.change_target_branch_at" (.OldRef|Escape) (.NewRef|Escape) $createdStr | Safe}}
  694. </span>
  695. </div>
  696. {{else if eq .Type 26}}
  697. <div class="timeline-item event" id="{{.HashTag}}">
  698. <span class="badge">{{svg "octicon-clock"}}</span>
  699. <a href="{{.Poster.HomeLink}}">
  700. {{avatar .Poster}}
  701. </a>
  702. <span class="text grey">
  703. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  704. {{$.i18n.Tr "repo.issues.del_time_history" $createdStr | Safe}}
  705. </span>
  706. <div class="detail">
  707. {{svg "octicon-clock"}}
  708. <span class="text grey">{{.Content}}</span>
  709. </div>
  710. </div>
  711. {{else if eq .Type 27}}
  712. <div class="timeline-item event" id="{{.HashTag}}">
  713. <span class="badge">{{svg "octicon-eye"}}</span>
  714. <a href="{{.Poster.HomeLink}}">
  715. {{avatar .Poster}}
  716. </a>
  717. <span class="text grey">
  718. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  719. {{if (gt .AssigneeID 0)}}
  720. {{if .RemovedAssignee}}
  721. {{if eq .PosterID .AssigneeID}}
  722. {{$.i18n.Tr "repo.issues.review.remove_review_request_self" $createdStr | Safe}}
  723. {{else}}
  724. {{$.i18n.Tr "repo.issues.review.remove_review_request" (.Assignee.GetDisplayName|Escape) $createdStr | Safe}}
  725. {{end}}
  726. {{else}}
  727. {{$.i18n.Tr "repo.issues.review.add_review_request" (.Assignee.GetDisplayName|Escape) $createdStr | Safe}}
  728. {{end}}
  729. {{else}}
  730. {{if .RemovedAssignee}}
  731. {{$.i18n.Tr "repo.issues.review.remove_review_request" (.AssigneeTeam.Name|Escape) $createdStr | Safe}}
  732. {{else}}
  733. {{$.i18n.Tr "repo.issues.review.add_review_request" (.AssigneeTeam.Name|Escape) $createdStr | Safe}}
  734. {{end}}
  735. {{end}}
  736. </span>
  737. </div>
  738. {{else if and (eq .Type 29) (or (gt .CommitsNum 0) .IsForcePush)}}
  739. <div class="timeline-item event" id="{{.HashTag}}">
  740. <span class="badge">{{svg "octicon-repo-push"}}</span>
  741. <span class="text grey">
  742. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  743. {{ if .IsForcePush }}
  744. {{$.i18n.Tr "repo.issues.force_push_codes" ($.Issue.PullRequest.HeadBranch|Escape) (ShortSha .OldCommit) (($.Issue.Repo.CommitLink .OldCommit)|Escape) (ShortSha .NewCommit) (($.Issue.Repo.CommitLink .NewCommit)|Escape) $createdStr | Safe}}
  745. {{else}}
  746. {{$.i18n.TrN (len .Commits) "repo.issues.push_commit_1" "repo.issues.push_commits_n" (len .Commits) $createdStr | Safe}}
  747. {{end}}
  748. </span>
  749. </div>
  750. {{if not .IsForcePush}}
  751. {{template "repo/commits_list_small" dict "comment" . "root" $}}
  752. {{end}}
  753. {{else if eq .Type 30}}
  754. {{if not $.UnitProjectsGlobalDisabled}}
  755. <div class="timeline-item event" id="{{.HashTag}}">
  756. <span class="badge">{{svg "octicon-project"}}</span>
  757. <a href="{{.Poster.HomeLink}}">
  758. {{avatar .Poster}}
  759. </a>
  760. <span class="text grey">
  761. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  762. {{if gt .OldProjectID 0}}
  763. {{if gt .ProjectID 0}}
  764. {{$.i18n.Tr "repo.issues.change_project_at" (.OldProject.Title|Escape) (.Project.Title|Escape) $createdStr | Safe}}
  765. {{else}}
  766. {{$.i18n.Tr "repo.issues.remove_project_at" (.OldProject.Title|Escape) $createdStr | Safe}}
  767. {{end}}
  768. {{else if gt .ProjectID 0}}
  769. {{$.i18n.Tr "repo.issues.add_project_at" (.Project.Title|Escape) $createdStr | Safe}}
  770. {{end}}
  771. </span>
  772. </div>
  773. {{end}}
  774. {{else if eq .Type 32}}
  775. <div class="timeline-item-group">
  776. <div class="timeline-item event" id="{{.HashTag}}">
  777. <a class="timeline-avatar"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>
  778. <img src="{{.Poster.AvatarLink}}">
  779. </a>
  780. <span class="badge grey">{{svg "octicon-x" 16}}</span>
  781. <span class="text grey">
  782. <a class="author"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>{{.Poster.GetDisplayName}}</a>
  783. {{$reviewerName := ""}}
  784. {{if eq .Review.OriginalAuthor ""}}
  785. {{$reviewerName = .Review.Reviewer.Name}}
  786. {{else}}
  787. {{$reviewerName = .Review.OriginalAuthor}}
  788. {{end}}
  789. {{$.i18n.Tr "repo.issues.review.dismissed" $reviewerName $createdStr | Safe}}
  790. </span>
  791. </div>
  792. {{if .Content}}
  793. <div class="timeline-item comment">
  794. <div class="content">
  795. <div class="ui top attached header arrow-top">
  796. <span class="text grey">
  797. {{$.i18n.Tr "action.review_dismissed_reason"}}
  798. </span>
  799. </div>
  800. <div class="ui attached segment">
  801. <div class="render-content markup">
  802. {{if .RenderedContent}}
  803. {{.RenderedContent|Str2html}}
  804. {{else}}
  805. <span class="no-content">{{$.i18n.Tr "repo.issues.no_content"}}</span>
  806. {{end}}
  807. </div>
  808. </div>
  809. </div>
  810. </div>
  811. {{end}}
  812. </div>
  813. {{else if eq .Type 33}}
  814. <div class="timeline-item event" id="{{.HashTag}}">
  815. <span class="badge">{{svg "octicon-git-branch"}}</span>
  816. <a href="{{.Poster.HomeLink}}">
  817. {{avatar .Poster}}
  818. </a>
  819. <span class="text grey">
  820. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  821. {{if and .OldRef .NewRef}}
  822. {{$.i18n.Tr "repo.issues.change_ref_at" (.OldRef|Escape) (.NewRef|Escape) $createdStr | Safe}}
  823. {{else if .OldRef}}
  824. {{$.i18n.Tr "repo.issues.remove_ref_at" (.OldRef|Escape) $createdStr | Safe}}
  825. {{else}}
  826. {{$.i18n.Tr "repo.issues.add_ref_at" (.NewRef|Escape) $createdStr | Safe}}
  827. {{end}}
  828. </span>
  829. </div>
  830. {{end}}
  831. {{end}}
  832. {{end}}