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 28KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665
  1. {{ template "base/alert" }}
  2. {{range .Issue.Comments}}
  3. {{ $createdStr:= TimeSinceUnix .CreatedUnix $.Lang }}
  4. <!-- 0 = COMMENT, 1 = REOPEN, 2 = CLOSE, 3 = ISSUE_REF, 4 = COMMIT_REF,
  5. 5 = COMMENT_REF, 6 = PULL_REF, 7 = COMMENT_LABEL, 12 = START_TRACKING,
  6. 13 = STOP_TRACKING, 14 = ADD_TIME_MANUAL, 16 = ADDED_DEADLINE, 17 = MODIFIED_DEADLINE,
  7. 18 = REMOVED_DEADLINE, 19 = ADD_DEPENDENCY, 20 = REMOVE_DEPENDENCY, 21 = CODE,
  8. 22 = REVIEW, 23 = ISSUE_LOCKED, 24 = ISSUE_UNLOCKED, 25 = TARGET_BRANCH_CHANGED,
  9. 26 = DELETE_TIME_MANUAL, 27 = REVIEW_REQUEST, 28 = MERGE_PULL_REQUEST,
  10. 29 = PULL_PUSH_EVENT, 30 = PROJECT_CHANGED, 31 = PROJECT_BOARD_CHANGED -->
  11. {{if eq .Type 0}}
  12. <div class="timeline-item comment" id="{{.HashTag}}">
  13. {{if .OriginalAuthor }}
  14. <span class="timeline-avatar"><img src="/img/avatar_default.png"></span>
  15. {{else}}
  16. <a class="timeline-avatar" {{if gt .Poster.ID 0}}href="{{.Poster.HomeLink}}"{{end}}>
  17. <img src="{{.Poster.RelAvatarLink}}">
  18. </a>
  19. {{end}}
  20. <div class="content">
  21. <div class="ui top attached header">
  22. {{if .OriginalAuthor }}
  23. <span class="text black"><i class="fa {{MigrationIcon $.Repository.GetOriginalURLHostname}}" aria-hidden="true"></i> {{ .OriginalAuthor }}</span><span class="text grey"> {{$.i18n.Tr "repo.issues.commented_at" .Issue.HashTag $createdStr | Safe}} {{if $.Repository.OriginalURL}}</span><span class="text migrate">({{$.i18n.Tr "repo.migrated_from" $.Repository.OriginalURL $.Repository.GetOriginalURLHostname | Safe }}){{end}}</span>
  24. {{else}}
  25. <span class="text grey"><a class="author"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>{{.Poster.GetDisplayName}}</a> {{$.i18n.Tr "repo.issues.commented_at" .HashTag $createdStr | Safe}}</span>
  26. {{end}}
  27. {{if not $.Repository.IsArchived}}
  28. <div class="ui right actions">
  29. {{if eq .PosterID .Issue.PosterID }}
  30. <div class="ui basic label">
  31. {{$.i18n.Tr "repo.issues.poster"}}
  32. </div>
  33. {{end}}
  34. {{if gt .ShowTag 0}}
  35. <div class="ui basic label">
  36. {{if eq .ShowTag 2}}
  37. {{$.i18n.Tr "repo.issues.collaborator"}}
  38. {{else if eq .ShowTag 3}}
  39. {{$.i18n.Tr "repo.issues.owner"}}
  40. {{end}}
  41. </div>
  42. {{end}}
  43. {{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID)}}
  44. {{template "repo/issue/view_content/context_menu" Dict "ctx" $ "item" . "delete" true "diff" false "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}}
  45. </div>
  46. {{end}}
  47. </div>
  48. <div class="ui attached segment">
  49. <div class="render-content markdown">
  50. {{if .RenderedContent}}
  51. {{.RenderedContent|Str2html}}
  52. {{else}}
  53. <span class="no-content">{{$.i18n.Tr "repo.issues.no_content"}}</span>
  54. {{end}}
  55. </div>
  56. <div id="comment-{{.ID}}" class="raw-content hide">{{.Content}}</div>
  57. <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>
  58. {{if .Attachments}}
  59. <div class="dropzone-attachments">
  60. <div class="ui clearing divider"></div>
  61. <div class="ui middle aligned padded grid">
  62. {{template "repo/issue/view_content/attachments" Dict "ctx" $ "Attachments" .Attachments}}
  63. </div>
  64. </div>
  65. {{end}}
  66. </div>
  67. {{$reactions := .Reactions.GroupByType}}
  68. {{if $reactions}}
  69. <div class="ui attached segment reactions">
  70. {{template "repo/issue/view_content/reactions" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}}
  71. </div>
  72. {{end}}
  73. </div>
  74. </div>
  75. {{else if eq .Type 1}}
  76. <div class="timeline-item event" id="{{.HashTag}}">
  77. <span class="badge">{{svg "octicon-dot-fill"}}</span>
  78. <a class="ui avatar image" href="{{.Poster.HomeLink}}">
  79. <img src="{{.Poster.RelAvatarLink}}">
  80. </a>
  81. <span class="text grey">
  82. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  83. {{if .Issue.IsPull }}
  84. {{$.i18n.Tr "repo.pulls.reopened_at" .EventTag $createdStr | Safe}}
  85. {{else}}
  86. {{$.i18n.Tr "repo.issues.reopened_at" .EventTag $createdStr | Safe}}
  87. {{end}}
  88. </span>
  89. </div>
  90. {{else if eq .Type 2}}
  91. <div class="timeline-item event" id="{{.HashTag}}">
  92. <span class="badge">{{svg "octicon-circle-slash"}}</span>
  93. <a class="ui avatar image" href="{{.Poster.HomeLink}}">
  94. <img src="{{.Poster.RelAvatarLink}}">
  95. </a>
  96. <span class="text grey">
  97. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  98. {{if .Issue.IsPull }}
  99. {{$.i18n.Tr "repo.pulls.closed_at" .EventTag $createdStr | Safe}}
  100. {{else}}
  101. {{$.i18n.Tr "repo.issues.closed_at" .EventTag $createdStr | Safe}}
  102. {{end}}
  103. </span>
  104. </div>
  105. {{else if eq .Type 28}}
  106. <div class="timeline-item event" id="{{.HashTag}}">
  107. <span class="badge purple">{{svg "octicon-git-merge"}}</span>
  108. <a class="ui avatar image" href="{{.Poster.HomeLink}}">
  109. <img src="{{.Poster.RelAvatarLink}}">
  110. </a>
  111. <span class="text grey">
  112. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  113. {{$link := printf "%s/commit/%s" $.Repository.HTMLURL $.Issue.PullRequest.MergedCommitID}}
  114. {{$.i18n.Tr "repo.issues.pull_merged_at" $link (ShortSha $.Issue.PullRequest.MergedCommitID) ($.BaseTarget|Escape) $createdStr | Str2html}}
  115. </span>
  116. </div>
  117. {{else if eq .Type 3 5 6}}
  118. {{ $refFrom:= "" }}
  119. {{if ne .RefRepoID .Issue.RepoID}}
  120. {{ $refFrom = $.i18n.Tr "repo.issues.ref_from" .RefRepo.FullName }}
  121. {{end}}
  122. {{ $refTr := "repo.issues.ref_issue_from" }}
  123. {{if .Issue.IsPull}}
  124. {{ $refTr = "repo.issues.ref_pull_from" }}
  125. {{else if eq .RefAction 1 }}
  126. {{ $refTr = "repo.issues.ref_closing_from" }}
  127. {{else if eq .RefAction 2 }}
  128. {{ $refTr = "repo.issues.ref_reopening_from" }}
  129. {{end}}
  130. {{ $createdStr:= TimeSinceUnix .CreatedUnix $.Lang }}
  131. <div class="timeline-item event" id="{{.HashTag}}">
  132. <span class="badge">{{svg "octicon-bookmark"}}</span>
  133. <a class="ui avatar image" href="{{.Poster.HomeLink}}">
  134. <img src="{{.Poster.RelAvatarLink}}">
  135. </a>
  136. {{if eq .RefAction 3}}<del>{{end}}
  137. <span class="text grey">
  138. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  139. {{$.i18n.Tr $refTr .EventTag $createdStr .RefCommentHTMLURL $refFrom | Safe}}
  140. </span>
  141. {{if eq .RefAction 3}}</del>{{end}}
  142. <div class="detail">
  143. <span class="text grey"><a href="{{.RefIssueHTMLURL}}"><b>{{.RefIssueTitle | Str2html}}</b> {{.RefIssueIdent | Str2html}}</a></span>
  144. </div>
  145. </div>
  146. {{else if eq .Type 4}}
  147. <div class="timeline-item event" id="{{.HashTag}}">
  148. <span class="badge">{{svg "octicon-bookmark"}}</span>
  149. <a class="ui avatar image" href="{{.Poster.HomeLink}}">
  150. <img src="{{.Poster.RelAvatarLink}}">
  151. </a>
  152. <span class="text grey">
  153. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  154. {{$.i18n.Tr "repo.issues.commit_ref_at" .EventTag $createdStr | Safe}}
  155. </span>
  156. <div class="detail">
  157. {{svg "octicon-git-commit"}}
  158. <span class="text grey">{{.Content | Str2html}}</span>
  159. </div>
  160. </div>
  161. {{else if eq .Type 7}}
  162. {{if or .AddedLabels .RemovedLabels}}
  163. <div class="timeline-item event" id="{{.HashTag}}">
  164. <span class="badge">{{svg "octicon-tag"}}</span>
  165. <a class="ui avatar image" href="{{.Poster.HomeLink}}">
  166. <img src="{{.Poster.RelAvatarLink}}">
  167. </a>
  168. <span class="text grey">
  169. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  170. {{if and .AddedLabels (not .RemovedLabels)}}
  171. {{$.i18n.Tr (TrN $.i18n.Lang (len .AddedLabels) "repo.issues.add_label" "repo.issues.add_labels") (RenderLabels .AddedLabels) $createdStr | Safe}}
  172. {{else if and (not .AddedLabels) .RemovedLabels}}
  173. {{$.i18n.Tr (TrN $.i18n.Lang (len .RemovedLabels) "repo.issues.remove_label" "repo.issues.remove_labels") (RenderLabels .RemovedLabels) $createdStr | Safe}}
  174. {{else}}
  175. {{$.i18n.Tr "repo.issues.add_remove_labels" (RenderLabels .AddedLabels) (RenderLabels .RemovedLabels) $createdStr | Safe}}
  176. {{end}}
  177. </span>
  178. </div>
  179. {{end}}
  180. {{else if eq .Type 8}}
  181. <div class="timeline-item event" id="{{.HashTag}}">
  182. <span class="badge">{{svg "octicon-milestone"}}</span>
  183. <a class="ui avatar image" href="{{.Poster.HomeLink}}">
  184. <img src="{{.Poster.RelAvatarLink}}">
  185. </a>
  186. <span class="text grey">
  187. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  188. {{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}}
  189. </span>
  190. </div>
  191. {{else if eq .Type 9}}
  192. <div class="timeline-item event" id="{{.HashTag}}">
  193. <span class="badge">{{svg "octicon-person"}}</span>
  194. {{if gt .AssigneeID 0}}
  195. {{if .RemovedAssignee}}
  196. <a class="ui avatar image" href="{{.Assignee.HomeLink}}">
  197. <img src="{{.Assignee.RelAvatarLink}}">
  198. </a>
  199. <span class="text grey">
  200. <a class="author" href="{{.Assignee.HomeLink}}">{{.Assignee.GetDisplayName}}</a>
  201. {{ if eq .Poster.ID .Assignee.ID }}
  202. {{$.i18n.Tr "repo.issues.remove_self_assignment" $createdStr | Safe}}
  203. {{ else }}
  204. {{$.i18n.Tr "repo.issues.remove_assignee_at" (.Poster.GetDisplayName|Escape) $createdStr | Safe}}
  205. {{ end }}
  206. </span>
  207. {{else}}
  208. <a class="ui avatar image" href="{{.Assignee.HomeLink}}">
  209. <img src="{{.Assignee.RelAvatarLink}}">
  210. </a>
  211. <span class="text grey">
  212. <a class="author" href="{{.Assignee.HomeLink}}">{{.Assignee.GetDisplayName}}</a>
  213. {{if eq .Poster.ID .AssigneeID}}
  214. {{$.i18n.Tr "repo.issues.self_assign_at" $createdStr | Safe}}
  215. {{else}}
  216. {{$.i18n.Tr "repo.issues.add_assignee_at" (.Poster.GetDisplayName|Escape) $createdStr | Safe}}
  217. {{end}}
  218. </span>
  219. {{end}}
  220. {{end}}
  221. </div>
  222. {{else if eq .Type 10}}
  223. <div class="timeline-item event" id="{{.HashTag}}">
  224. <span class="badge">{{svg "octicon-pencil"}}</span>
  225. <a class="ui avatar image" href="{{.Poster.HomeLink}}">
  226. <img src="{{.Poster.RelAvatarLink}}">
  227. </a>
  228. <span class="text grey">
  229. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  230. {{$.i18n.Tr "repo.issues.change_title_at" (.OldTitle|RenderEmoji) (.NewTitle|RenderEmoji) $createdStr | Safe}}
  231. </span>
  232. </div>
  233. {{else if eq .Type 11}}
  234. <div class="timeline-item event" id="{{.HashTag}}">
  235. <span class="badge">{{svg "octicon-git-branch"}}</span>
  236. <a class="ui avatar image" href="{{.Poster.HomeLink}}">
  237. <img src="{{.Poster.RelAvatarLink}}">
  238. </a>
  239. <span class="text grey">
  240. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  241. {{$.i18n.Tr "repo.issues.delete_branch_at" (.CommitSHA|Escape) $createdStr | Safe}}
  242. </span>
  243. </div>
  244. {{else if eq .Type 12}}
  245. <div class="timeline-item event" id="{{.HashTag}}">
  246. <span class="badge">{{svg "octicon-clock"}}</span>
  247. <a class="ui avatar image" href="{{.Poster.HomeLink}}">
  248. <img src="{{.Poster.RelAvatarLink}}">
  249. </a>
  250. <span class="text grey">
  251. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  252. {{$.i18n.Tr "repo.issues.start_tracking_history" $createdStr | Safe}}
  253. </span>
  254. </div>
  255. {{else if eq .Type 13}}
  256. <div class="timeline-item event" id="{{.HashTag}}">
  257. <span class="badge">{{svg "octicon-clock"}}</span>
  258. <a class="ui avatar image" href="{{.Poster.HomeLink}}">
  259. <img src="{{.Poster.RelAvatarLink}}">
  260. </a>
  261. <span class="text grey">
  262. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  263. {{$.i18n.Tr "repo.issues.stop_tracking_history" $createdStr | Safe}}
  264. </span>
  265. <div class="detail">
  266. {{svg "octicon-clock"}}
  267. <span class="text grey">{{.Content}}</span>
  268. </div>
  269. </div>
  270. {{else if eq .Type 14}}
  271. <div class="timeline-item event" id="{{.HashTag}}">
  272. <span class="badge">{{svg "octicon-clock"}}</span>
  273. <a class="ui avatar image" href="{{.Poster.HomeLink}}">
  274. <img src="{{.Poster.RelAvatarLink}}">
  275. </a>
  276. <span class="text grey">
  277. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  278. {{$.i18n.Tr "repo.issues.add_time_history" $createdStr | Safe}}
  279. </span>
  280. <div class="detail">
  281. {{svg "octicon-clock"}}
  282. <span class="text grey">{{.Content}}</span>
  283. </div>
  284. </div>
  285. {{else if eq .Type 15}}
  286. <div class="timeline-item event" id="{{.HashTag}}">
  287. <span class="badge">{{svg "octicon-clock"}}</span>
  288. <a class="ui avatar image" href="{{.Poster.HomeLink}}">
  289. <img src="{{.Poster.RelAvatarLink}}">
  290. </a>
  291. <span class="text grey">
  292. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  293. {{$.i18n.Tr "repo.issues.cancel_tracking_history" $createdStr | Safe}}
  294. </span>
  295. </div>
  296. {{else if eq .Type 16}}
  297. <div class="timeline-item event" id="{{.HashTag}}">
  298. <span class="badge">{{svg "octicon-clock"}}</span>
  299. <a class="ui avatar image" href="{{.Poster.HomeLink}}">
  300. <img src="{{.Poster.RelAvatarLink}}">
  301. </a>
  302. <span class="text grey">
  303. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  304. {{$.i18n.Tr "repo.issues.due_date_added" .Content $createdStr | Safe}}
  305. </span>
  306. </div>
  307. {{else if eq .Type 17}}
  308. <div class="timeline-item event" id="{{.HashTag}}">
  309. <span class="badge">{{svg "octicon-clock"}}</span>
  310. <a class="ui avatar image" href="{{.Poster.HomeLink}}">
  311. <img src="{{.Poster.RelAvatarLink}}">
  312. </a>
  313. <span class="text grey">
  314. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  315. {{$.i18n.Tr "repo.issues.due_date_modified" (.Content | ParseDeadline) $createdStr | Safe}}
  316. </span>
  317. </div>
  318. {{else if eq .Type 18}}
  319. <div class="timeline-item event" id="{{.HashTag}}">
  320. <span class="badge">{{svg "octicon-clock"}}</span>
  321. <a class="ui avatar image" href="{{.Poster.HomeLink}}">
  322. <img src="{{.Poster.RelAvatarLink}}">
  323. </a>
  324. <span class="text grey">
  325. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  326. {{$.i18n.Tr "repo.issues.due_date_remove" .Content $createdStr | Safe}}
  327. </span>
  328. </div>
  329. {{else if eq .Type 19}}
  330. <div class="timeline-item event" id="{{.HashTag}}">
  331. <span class="badge">{{svg "octicon-package-dependents"}}</span>
  332. <a class="ui avatar image" href="{{.Poster.HomeLink}}">
  333. <img src="{{.Poster.RelAvatarLink}}">
  334. </a>
  335. <span class="text grey">
  336. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  337. {{$.i18n.Tr "repo.issues.dependency.added_dependency" $createdStr | Safe}}
  338. </span>
  339. {{if .DependentIssue}}
  340. <div class="detail">
  341. {{svg "octicon-plus"}}
  342. <span class="text grey">
  343. <a href="{{.DependentIssue.HTMLURL}}">
  344. {{if eq .DependentIssue.RepoID .Issue.RepoID}}
  345. #{{.DependentIssue.Index}} {{.DependentIssue.Title}}
  346. {{else}}
  347. {{.DependentIssue.Repo.FullName}}#{{.DependentIssue.Index}} - {{.DependentIssue.Title}}
  348. {{end}}
  349. </a>
  350. </span>
  351. </div>
  352. {{end}}
  353. </div>
  354. {{else if eq .Type 20}}
  355. <div class="timeline-item event" id="{{.HashTag}}">
  356. <span class="badge">{{svg "octicon-package-dependents"}}</span>
  357. <a class="ui avatar image" href="{{.Poster.HomeLink}}">
  358. <img src="{{.Poster.RelAvatarLink}}">
  359. </a>
  360. <span class="text grey">
  361. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  362. {{$.i18n.Tr "repo.issues.dependency.removed_dependency" $createdStr | Safe}}
  363. </span>
  364. {{if .DependentIssue}}
  365. <div class="detail">
  366. <span class="text grey">{{svg "octicon-trashcan"}}</span>
  367. <span class="text grey">
  368. <a href="{{.DependentIssue.HTMLURL}}">
  369. {{if eq .DependentIssue.RepoID .Issue.RepoID}}
  370. #{{.DependentIssue.Index}} {{.DependentIssue.Title}}
  371. {{else}}
  372. {{.DependentIssue.Repo.FullName}}#{{.DependentIssue.Index}} - {{.DependentIssue.Title}}
  373. {{end}}
  374. </a>
  375. </span>
  376. </div>
  377. {{end}}
  378. </div>
  379. {{else if eq .Type 22}}
  380. <div class="timeline-item-group">
  381. <div class="timeline-item event" id="{{.HashTag}}">
  382. {{if .OriginalAuthor }}
  383. {{else}}
  384. <a class="timeline-avatar"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>
  385. <img src="{{.Poster.RelAvatarLink}}">
  386. </a>
  387. {{end}}
  388. <span class="badge {{if eq .Review.Type 1}}green
  389. {{- else if eq .Review.Type 2}}grey
  390. {{- else if eq .Review.Type 3}}red
  391. {{- else}}grey{{end}}">{{svg (printf "octicon-%s" .Review.Type.Icon)}}</span>
  392. <span class="text grey">
  393. {{if .OriginalAuthor }}
  394. <span class="text black"><i class="fa {{MigrationIcon $.Repository.GetOriginalURLHostname}}" aria-hidden="true"></i> {{ .OriginalAuthor }}</span><span class="text grey"> {{if $.Repository.OriginalURL}}</span><span class="text migrate">({{$.i18n.Tr "repo.migrated_from" $.Repository.OriginalURL $.Repository.GetOriginalURLHostname | Safe }}){{end}}</span>
  395. {{else}}
  396. <a class="author"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>{{.Poster.GetDisplayName}}</a>
  397. {{end}}
  398. {{if eq .Review.Type 1}}
  399. {{$.i18n.Tr "repo.issues.review.approve" $createdStr | Safe}}
  400. {{else if eq .Review.Type 2}}
  401. {{$.i18n.Tr "repo.issues.review.comment" $createdStr | Safe}}
  402. {{else if eq .Review.Type 3}}
  403. {{$.i18n.Tr "repo.issues.review.reject" $createdStr | Safe}}
  404. {{else}}
  405. {{$.i18n.Tr "repo.issues.review.comment" $createdStr | Safe}}
  406. {{end}}
  407. </span>
  408. </div>
  409. {{if .Content}}
  410. <div class="timeline-item comment">
  411. <div class="content">
  412. <div class="ui top attached header arrow-top">
  413. <span class="text grey">
  414. {{if .OriginalAuthor }}
  415. <span class="text black"><i class="fa {{MigrationIcon $.Repository.GetOriginalURLHostname}}" aria-hidden="true"></i> {{ .OriginalAuthor }}</span><span class="text grey"> {{if $.Repository.OriginalURL}}</span><span class="text migrate">({{$.i18n.Tr "repo.migrated_from" $.Repository.OriginalURL $.Repository.GetOriginalURLHostname | Safe }}){{end}}</span>
  416. {{else}}
  417. <a class="author"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>{{.Poster.GetDisplayName}}</a>
  418. {{end}}
  419. {{$.i18n.Tr "repo.issues.review.left_comment" | Safe}}
  420. </span>
  421. </div>
  422. <div class="ui attached segment">
  423. <div class="render-content markdown">
  424. {{if .RenderedContent}}
  425. {{.RenderedContent|Str2html}}
  426. {{else}}
  427. <span class="no-content">{{$.i18n.Tr "repo.issues.no_content"}}</span>
  428. {{end}}
  429. </div>
  430. </div>
  431. </div>
  432. </div>
  433. {{end}}
  434. {{if .Review.CodeComments}}
  435. <div class="timeline-item event">
  436. {{ range $filename, $lines := .Review.CodeComments}}
  437. {{range $line, $comms := $lines}}
  438. <div class="ui segments">
  439. <div class="ui segment">
  440. {{$invalid := (index $comms 0).Invalidated}}
  441. {{$resolved := (index $comms 0).IsResolved}}
  442. {{$resolveDoer := (index $comms 0).ResolveDoer}}
  443. {{$isNotPending := (not (eq (index $comms 0).Review.Type 0))}}
  444. {{if or $invalid $resolved}}
  445. <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">
  446. {{svg "octicon-unfold"}}
  447. {{if $resolved}}
  448. {{$.i18n.Tr "repo.issues.review.show_resolved"}}
  449. {{else}}
  450. {{$.i18n.Tr "repo.issues.review.show_outdated"}}
  451. {{end}}
  452. </button>
  453. <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">
  454. {{svg "octicon-fold"}}
  455. {{if $resolved}}
  456. {{$.i18n.Tr "repo.issues.review.hide_resolved"}}
  457. {{else}}
  458. {{$.i18n.Tr "repo.issues.review.hide_outdated"}}
  459. {{end}}
  460. </button>
  461. {{end}}
  462. <a href="{{(index $comms 0).CodeCommentURL}}" class="file-comment">{{$filename}}</a>
  463. {{if $invalid }}
  464. <span class="ui label basic small yellow">
  465. {{$.i18n.Tr "repo.issues.review.outdated"}}
  466. </span>
  467. {{end}}
  468. </div>
  469. {{$diff := (CommentMustAsDiff (index $comms 0))}}
  470. {{if $diff}}
  471. {{$file := (index $diff.Files 0)}}
  472. <div id="code-preview-{{(index $comms 0).ID}}" class="ui table segment{{if $resolved}} hide{{end}}">
  473. <div class="diff-file-box diff-box file-content {{TabSizeClass $.Editorconfig $file.Name}}">
  474. <div class="file-body file-code code-view code-diff code-diff-unified">
  475. <table>
  476. <tbody>
  477. {{template "repo/diff/section_unified" dict "file" $file "root" $}}
  478. </tbody>
  479. </table>
  480. </div>
  481. </div>
  482. </div>
  483. {{end}}
  484. <div id="code-comments-{{(index $comms 0).ID}}" class="ui segment{{if $resolved}} hide{{end}}">
  485. <div class="ui comments">
  486. {{range $comms}}
  487. {{ $createdSubStr:= TimeSinceUnix .CreatedUnix $.Lang }}
  488. <div class="comment" id="{{.HashTag}}">
  489. {{if not .OriginalAuthor }}
  490. <a class="avatar">
  491. <img src="{{.Poster.RelAvatarLink}}">
  492. </a>
  493. {{end}}
  494. <div class="content">
  495. <div class="code-comment-content">
  496. <span class="text grey">
  497. {{if .OriginalAuthor }}
  498. <span class="text black"><i class="fa {{MigrationIcon $.Repository.GetOriginalURLHostname}}" aria-hidden="true"></i> {{ .OriginalAuthor }}</span><span class="text grey"> {{if $.Repository.OriginalURL}}</span><span class="text migrate">({{$.i18n.Tr "repo.migrated_from" $.Repository.OriginalURL $.Repository.GetOriginalURLHostname | Safe }}){{end}}</span>
  499. {{else}}
  500. <a class="author"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>{{.Poster.GetDisplayName}}</a>
  501. {{end}}
  502. {{$.i18n.Tr "repo.issues.commented_at" .HashTag $createdSubStr | Safe}}
  503. </span>
  504. <div class="text">
  505. <div class="render-content markdown">
  506. {{if .RenderedContent}}
  507. {{.RenderedContent|Str2html}}
  508. {{else}}
  509. <span class="no-content">{{$.i18n.Tr "repo.issues.no_content"}}</span>
  510. {{end}}
  511. </div>
  512. <div class="raw-content hide">{{.Content}}</div>
  513. </div>
  514. </div>
  515. </div>
  516. </div>
  517. {{end}}
  518. </div>
  519. {{template "repo/diff/comment_form_datahandler" dict "hidden" true "reply" (index $comms 0).ReviewID "root" $ "comment" (index $comms 0)}}
  520. {{if and $.CanMarkConversation $isNotPending}}
  521. <button class="ui tiny button resolve-conversation" data-action="{{if not $resolved}}Resolve{{else}}UnResolve{{end}}" data-comment-id="{{(index $comms 0).ID}}" data-update-url="{{$.RepoLink}}/issues/resolve_conversation" >
  522. {{if $resolved}}
  523. {{$.i18n.Tr "repo.issues.review.un_resolve_conversation"}}
  524. {{else}}
  525. {{$.i18n.Tr "repo.issues.review.resolve_conversation"}}
  526. {{end}}
  527. </button>
  528. {{end}}
  529. {{if $resolved}}
  530. <span class="ui grey text"><b>{{$resolveDoer.Name}}</b> {{$.i18n.Tr "repo.issues.review.resolved_by"}}</span>
  531. {{end}}
  532. </div>
  533. </div>
  534. {{end}}
  535. {{end}}
  536. </div>
  537. {{end}}
  538. </div>
  539. {{else if eq .Type 23}}
  540. <div class="timeline-item event" id="{{.HashTag}}">
  541. <span class="badge">{{svg "octicon-lock"}}</span>
  542. <a class="ui avatar image" href="{{.Poster.HomeLink}}">
  543. <img src="{{.Poster.RelAvatarLink}}">
  544. </a>
  545. {{ if .Content }}
  546. <span class="text grey">
  547. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  548. {{$.i18n.Tr "repo.issues.lock_with_reason" .Content $createdStr | Safe}}
  549. </span>
  550. {{ else }}
  551. <span class="text grey">
  552. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  553. {{$.i18n.Tr "repo.issues.lock_no_reason" $createdStr | Safe}}
  554. </span>
  555. {{ end }}
  556. </div>
  557. {{else if eq .Type 24}}
  558. <div class="timeline-item event" id="{{.HashTag}}">
  559. <span class="badge">{{svg "octicon-key"}}</span>
  560. <a class="ui avatar image" href="{{.Poster.HomeLink}}">
  561. <img src="{{.Poster.RelAvatarLink}}">
  562. </a>
  563. <span class="text grey">
  564. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  565. {{$.i18n.Tr "repo.issues.unlock_comment" $createdStr | Safe}}
  566. </span>
  567. </div>
  568. {{else if eq .Type 25}}
  569. <div class="timeline-item event">
  570. <span class="badge">{{svg "octicon-git-branch"}}</span>
  571. <a class="ui avatar image" href="{{.Poster.HomeLink}}">
  572. <img src="{{.Poster.RelAvatarLink}}">
  573. </a>
  574. <span class="text grey">
  575. <a href="{{.Poster.HomeLink}}">{{.Poster.Name}}</a>
  576. {{$.i18n.Tr "repo.pulls.change_target_branch_at" (.OldRef|Escape) (.NewRef|Escape) $createdStr | Safe}}
  577. </span>
  578. </div>
  579. {{else if eq .Type 26}}
  580. <div class="timeline-item event" id="{{.HashTag}}">
  581. <span class="badge">{{svg "octicon-clock"}}</span>
  582. <a class="ui avatar image" href="{{.Poster.HomeLink}}">
  583. <img src="{{.Poster.RelAvatarLink}}">
  584. </a>
  585. <span class="text grey">
  586. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  587. {{$.i18n.Tr "repo.issues.del_time_history" $createdStr | Safe}}
  588. </span>
  589. <div class="detail">
  590. {{svg "octicon-clock"}}
  591. <span class="text grey">{{.Content}}</span>
  592. </div>
  593. </div>
  594. {{else if eq .Type 27}}
  595. <div class="timeline-item event" id="{{.HashTag}}">
  596. <span class="badge">{{svg "octicon-eye"}}</span>
  597. <a class="ui avatar image" href="{{.Poster.HomeLink}}">
  598. <img src="{{.Poster.RelAvatarLink}}">
  599. </a>
  600. <span class="text grey">
  601. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  602. {{if (gt .AssigneeID 0)}}
  603. {{if .RemovedAssignee}}
  604. {{if eq .PosterID .AssigneeID}}
  605. {{$.i18n.Tr "repo.issues.review.remove_review_request_self" $createdStr | Safe}}
  606. {{else}}
  607. {{$.i18n.Tr "repo.issues.review.remove_review_request" (.Assignee.GetDisplayName|Escape) $createdStr | Safe}}
  608. {{end}}
  609. {{else}}
  610. {{$.i18n.Tr "repo.issues.review.add_review_request" (.Assignee.GetDisplayName|Escape) $createdStr | Safe}}
  611. {{end}}
  612. {{else}}
  613. {{if .RemovedAssignee}}
  614. {{$.i18n.Tr "repo.issues.review.remove_review_request" (.AssigneeTeam.Name|Escape) $createdStr | Safe}}
  615. {{else}}
  616. {{$.i18n.Tr "repo.issues.review.add_review_request" (.AssigneeTeam.Name|Escape) $createdStr | Safe}}
  617. {{end}}
  618. {{end}}
  619. </span>
  620. </div>
  621. {{else if and (eq .Type 29) (or (gt .CommitsNum 0) .IsForcePush)}}
  622. <div class="timeline-item event" id="{{.HashTag}}">
  623. <span class="badge">{{svg "octicon-repo-push"}}</span>
  624. <span class="text grey">
  625. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  626. {{ if .IsForcePush }}
  627. {{$.i18n.Tr "repo.issues.force_push_codes" $.Issue.PullRequest.HeadBranch (ShortSha .OldCommit) ($.Issue.Repo.CommitLink .OldCommit) (ShortSha .NewCommit) ($.Issue.Repo.CommitLink .NewCommit) $createdStr | Safe}}
  628. {{else}}
  629. {{$.i18n.Tr (TrN $.i18n.Lang .Commits.Len "repo.issues.push_commit_1" "repo.issues.push_commits_n") .Commits.Len $createdStr | Safe}}
  630. {{end}}
  631. </span>
  632. </div>
  633. {{if not .IsForcePush}}
  634. {{template "repo/commits_list_small" dict "comment" . "root" $}}
  635. {{end}}
  636. {{else if eq .Type 30}}
  637. {{if not $.UnitProjectsGlobalDisabled}}
  638. <div class="timeline-item event" id="{{.HashTag}}">
  639. <span class="badge">{{svg "octicon-project"}}</span>
  640. <a class="ui avatar image" href="{{.Poster.HomeLink}}">
  641. <img src="{{.Poster.RelAvatarLink}}">
  642. </a>
  643. <span class="text grey">
  644. <a class="author" href="{{.Poster.HomeLink}}">{{.Poster.GetDisplayName}}</a>
  645. {{if gt .OldProjectID 0}}
  646. {{if gt .ProjectID 0}}
  647. {{$.i18n.Tr "repo.issues.change_project_at" (.OldProject.Title|Escape) (.Project.Title|Escape) $createdStr | Safe}}
  648. {{else}}
  649. {{$.i18n.Tr "repo.issues.remove_project_at" (.OldProject.Title|Escape) $createdStr | Safe}}
  650. {{end}}
  651. {{else if gt .ProjectID 0}}
  652. {{$.i18n.Tr "repo.issues.add_project_at" (.Project.Title|Escape) $createdStr | Safe}}
  653. {{end}}
  654. </span>
  655. </div>
  656. {{end}}
  657. {{end}}
  658. {{end}}