您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

comments.tmpl 30KB

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