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

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