18dd9f9a3f
1. Check whether the label is for an issue or a pull request. 2. Don't use space to layout 3. Make sure the test strings have trailing spaces explicitly, to avoid some IDE removing the trailing spaces automatically.
686 lines
31 KiB
Handlebars
686 lines
31 KiB
Handlebars
{{template "base/alert"}}
|
|
{{range .Issue.Comments}}
|
|
{{if call $.ShouldShowCommentType .Type}}
|
|
{{$createdStr:= TimeSinceUnix .CreatedUnix ctx.Locale}}
|
|
|
|
<!-- 0 = COMMENT, 1 = REOPEN, 2 = CLOSE, 3 = ISSUE_REF, 4 = COMMIT_REF,
|
|
5 = COMMENT_REF, 6 = PULL_REF, 7 = COMMENT_LABEL, 8 = MILESTONE_CHANGE,
|
|
9 = ASSIGNEES_CHANGE, 10 = TITLE_CHANGE, 11 = DELETE_BRANCH, 12 = START_TRACKING,
|
|
13 = STOP_TRACKING, 14 = ADD_TIME_MANUAL, 16 = ADDED_DEADLINE, 17 = MODIFIED_DEADLINE,
|
|
18 = REMOVED_DEADLINE, 19 = ADD_DEPENDENCY, 20 = REMOVE_DEPENDENCY, 21 = CODE,
|
|
22 = REVIEW, 23 = ISSUE_LOCKED, 24 = ISSUE_UNLOCKED, 25 = TARGET_BRANCH_CHANGED,
|
|
26 = DELETE_TIME_MANUAL, 27 = REVIEW_REQUEST, 28 = MERGE_PULL_REQUEST,
|
|
29 = PULL_PUSH_EVENT, 30 = PROJECT_CHANGED, 31 = PROJECT_BOARD_CHANGED
|
|
32 = DISMISSED_REVIEW, 33 = COMMENT_TYPE_CHANGE_ISSUE_REF, 34 = PR_SCHEDULE_TO_AUTO_MERGE,
|
|
35 = CANCEL_SCHEDULED_AUTO_MERGE_PR, 36 = PIN_ISSUE, 37 = UNPIN_ISSUE -->
|
|
{{if eq .Type 0}}
|
|
<div class="timeline-item comment" id="{{.HashTag}}">
|
|
{{if .OriginalAuthor}}
|
|
<span class="timeline-avatar">
|
|
{{ctx.AvatarUtils.Avatar nil 40}}
|
|
</span>
|
|
{{else}}
|
|
<a class="timeline-avatar"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>
|
|
{{ctx.AvatarUtils.Avatar .Poster 40}}
|
|
</a>
|
|
{{end}}
|
|
<div class="content comment-container">
|
|
<div class="ui top attached header comment-header tw-flex tw-items-center tw-justify-between" role="heading" aria-level="3">
|
|
<div class="comment-header-left tw-flex tw-items-center">
|
|
{{if .OriginalAuthor}}
|
|
<span class="text black tw-font-semibold tw-mr-1">
|
|
{{svg (MigrationIcon $.Repository.GetOriginalURLHostname)}}
|
|
{{.OriginalAuthor}}
|
|
</span>
|
|
<span class="text grey muted-links">
|
|
{{ctx.Locale.Tr "repo.issues.commented_at" .HashTag $createdStr}} {{if $.Repository.OriginalURL}}
|
|
</span>
|
|
<span class="text migrate">
|
|
({{ctx.Locale.Tr "repo.migrated_from" $.Repository.OriginalURL $.Repository.GetOriginalURLHostname}}){{end}}
|
|
</span>
|
|
{{else}}
|
|
{{if gt .Poster.ID 0}}
|
|
<a class="inline-timeline-avatar" href="{{.Poster.HomeLink}}">
|
|
{{ctx.AvatarUtils.Avatar .Poster 24}}
|
|
</a>
|
|
{{end}}
|
|
<span class="text grey muted-links">
|
|
{{template "shared/user/authorlink" .Poster}}
|
|
{{ctx.Locale.Tr "repo.issues.commented_at" .HashTag $createdStr}}
|
|
</span>
|
|
{{end}}
|
|
</div>
|
|
<div class="comment-header-right actions tw-flex tw-items-center">
|
|
{{template "repo/issue/view_content/show_role" dict "ShowRole" .ShowRole}}
|
|
{{if not $.Repository.IsArchived}}
|
|
{{template "repo/issue/view_content/add_reaction" dict "ctxData" $ "ActionURL" (printf "%s/comments/%d/reactions" $.RepoLink .ID)}}
|
|
{{end}}
|
|
{{template "repo/issue/view_content/context_menu" dict "ctxData" $ "item" . "delete" true "issue" true "diff" false "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}}
|
|
</div>
|
|
</div>
|
|
<div class="ui attached segment comment-body" role="article">
|
|
<div class="render-content markup" {{if or $.Permission.IsAdmin $.HasIssuesOrPullsWritePermission (and $.IsSigned (eq $.SignedUserID .PosterID))}}data-can-edit="true"{{end}}>
|
|
{{if .RenderedContent}}
|
|
{{.RenderedContent}}
|
|
{{else}}
|
|
<span class="no-content">{{ctx.Locale.Tr "repo.issues.no_content"}}</span>
|
|
{{end}}
|
|
</div>
|
|
<div id="issuecomment-{{.ID}}-raw" class="raw-content tw-hidden">{{.Content}}</div>
|
|
<div class="edit-content-zone tw-hidden" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div>
|
|
{{if .Attachments}}
|
|
{{template "repo/issue/view_content/attachments" dict "Attachments" .Attachments "RenderedContent" .RenderedContent}}
|
|
{{end}}
|
|
</div>
|
|
{{$reactions := .Reactions.GroupByType}}
|
|
{{if $reactions}}
|
|
{{template "repo/issue/view_content/reactions" dict "ctxData" $ "ActionURL" (printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}}
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
{{else if eq .Type 1}}
|
|
<div class="timeline-item event" id="{{.HashTag}}">
|
|
<span class="badge tw-bg-green tw-text-white">{{svg "octicon-dot-fill"}}</span>
|
|
{{if not .OriginalAuthor}}
|
|
{{template "shared/user/avatarlink" dict "user" .Poster}}
|
|
{{end}}
|
|
<span class="text grey muted-links">
|
|
{{template "repo/issue/view_content/comments_authorlink" dict "ctxData" $ "comment" .}}
|
|
{{if .Issue.IsPull}}
|
|
{{ctx.Locale.Tr "repo.pulls.reopened_at" .EventTag $createdStr}}
|
|
{{else}}
|
|
{{ctx.Locale.Tr "repo.issues.reopened_at" .EventTag $createdStr}}
|
|
{{end}}
|
|
</span>
|
|
</div>
|
|
{{else if eq .Type 2}}
|
|
<div class="timeline-item event" id="{{.HashTag}}">
|
|
<span class="badge tw-bg-red tw-text-white">{{svg "octicon-circle-slash"}}</span>
|
|
{{if not .OriginalAuthor}}
|
|
{{template "shared/user/avatarlink" dict "user" .Poster}}
|
|
{{end}}
|
|
<span class="text grey muted-links">
|
|
{{template "repo/issue/view_content/comments_authorlink" dict "ctxData" $ "comment" .}}
|
|
{{if .Issue.IsPull}}
|
|
{{ctx.Locale.Tr "repo.pulls.closed_at" .EventTag $createdStr}}
|
|
{{else}}
|
|
{{ctx.Locale.Tr "repo.issues.closed_at" .EventTag $createdStr}}
|
|
{{end}}
|
|
</span>
|
|
</div>
|
|
{{else if eq .Type 28}}
|
|
<div class="timeline-item event" id="{{.HashTag}}">
|
|
<span class="badge tw-bg-purple tw-text-white">{{svg "octicon-git-merge"}}</span>
|
|
{{if not .OriginalAuthor}}
|
|
{{template "shared/user/avatarlink" dict "user" .Poster}}
|
|
{{end}}
|
|
<span class="text grey muted-links">
|
|
{{template "repo/issue/view_content/comments_authorlink" dict "ctxData" $ "comment" .}}
|
|
{{$link := printf "%s/commit/%s" $.Repository.Link ($.Issue.PullRequest.MergedCommitID|PathEscape)}}
|
|
{{if eq $.Issue.PullRequest.Status 3}}
|
|
{{ctx.Locale.Tr "repo.issues.comment_manually_pull_merged_at" (HTMLFormat `<a class="ui sha" href="%[1]s"><b>%[2]s</b></a>` $link (ShortSha $.Issue.PullRequest.MergedCommitID)) (HTMLFormat "<b>%[1]s</b>" $.BaseTarget) $createdStr}}
|
|
{{else}}
|
|
{{ctx.Locale.Tr "repo.issues.comment_pull_merged_at" (HTMLFormat `<a class="ui sha" href="%[1]s"><b>%[2]s</b></a>` $link (ShortSha $.Issue.PullRequest.MergedCommitID)) (HTMLFormat "<b>%[1]s</b>" $.BaseTarget) $createdStr}}
|
|
{{end}}
|
|
</span>
|
|
</div>
|
|
{{else if eq .Type 3 5 6}}
|
|
{{$refFrom:= ""}}
|
|
{{if ne .RefRepoID .Issue.RepoID}}
|
|
{{$refFrom = ctx.Locale.Tr "repo.issues.ref_from" .RefRepo.FullName}}
|
|
{{end}}
|
|
{{$refTr := "repo.issues.ref_issue_from"}}
|
|
{{if .Issue.IsPull}}
|
|
{{$refTr = "repo.issues.ref_pull_from"}}
|
|
{{else if eq .RefAction 1}}
|
|
{{$refTr = "repo.issues.ref_closing_from"}}
|
|
{{else if eq .RefAction 2}}
|
|
{{$refTr = "repo.issues.ref_reopening_from"}}
|
|
{{end}}
|
|
{{$createdStr:= TimeSinceUnix .CreatedUnix ctx.Locale}}
|
|
<div class="timeline-item event" id="{{.HashTag}}">
|
|
<span class="badge">{{svg "octicon-bookmark"}}</span>
|
|
{{template "shared/user/avatarlink" dict "user" .Poster}}
|
|
{{if eq .RefAction 3}}<del>{{end}}
|
|
<span class="text grey muted-links">
|
|
{{template "shared/user/authorlink" .Poster}}
|
|
{{ctx.Locale.Tr $refTr .EventTag $createdStr (.RefCommentLink ctx) $refFrom}}
|
|
</span>
|
|
{{if eq .RefAction 3}}</del>{{end}}
|
|
|
|
<div class="detail flex-text-block">
|
|
<span class="text grey muted-links"><a href="{{.RefIssueLink ctx}}"><b>{{.RefIssueTitle ctx}}</b> {{.RefIssueIdent ctx}}</a></span>
|
|
</div>
|
|
</div>
|
|
{{else if eq .Type 4}}
|
|
<div class="timeline-item event" id="{{.HashTag}}">
|
|
<span class="badge">{{svg "octicon-bookmark"}}</span>
|
|
{{template "shared/user/avatarlink" dict "user" .Poster}}
|
|
<span class="text grey muted-links">
|
|
{{template "shared/user/authorlink" .Poster}}
|
|
{{ctx.Locale.Tr "repo.issues.commit_ref_at" .EventTag $createdStr}}
|
|
</span>
|
|
<div class="detail flex-text-block">
|
|
{{svg "octicon-git-commit"}}
|
|
<span class="text grey muted-links">{{.Content | SanitizeHTML}}</span>
|
|
</div>
|
|
</div>
|
|
{{else if eq .Type 7}}
|
|
{{if or .AddedLabels .RemovedLabels}}
|
|
<div class="timeline-item event" id="{{.HashTag}}">
|
|
<span class="badge">{{svg "octicon-tag"}}</span>
|
|
{{template "shared/user/avatarlink" dict "user" .Poster}}
|
|
<span class="text grey muted-links">
|
|
{{template "shared/user/authorlink" .Poster}}
|
|
{{if and .AddedLabels (not .RemovedLabels)}}
|
|
{{ctx.Locale.TrN (len .AddedLabels) "repo.issues.add_label" "repo.issues.add_labels" (RenderLabels ctx ctx.Locale .AddedLabels $.RepoLink .Issue) $createdStr}}
|
|
{{else if and (not .AddedLabels) .RemovedLabels}}
|
|
{{ctx.Locale.TrN (len .RemovedLabels) "repo.issues.remove_label" "repo.issues.remove_labels" (RenderLabels ctx ctx.Locale .RemovedLabels $.RepoLink .Issue) $createdStr}}
|
|
{{else}}
|
|
{{ctx.Locale.Tr "repo.issues.add_remove_labels" (RenderLabels ctx ctx.Locale .AddedLabels $.RepoLink .Issue) (RenderLabels ctx ctx.Locale .RemovedLabels $.RepoLink .Issue) $createdStr}}
|
|
{{end}}
|
|
</span>
|
|
</div>
|
|
{{end}}
|
|
{{else if eq .Type 8}}
|
|
<div class="timeline-item event" id="{{.HashTag}}">
|
|
<span class="badge">{{svg "octicon-milestone"}}</span>
|
|
{{template "shared/user/avatarlink" dict "user" .Poster}}
|
|
<span class="text grey muted-links">
|
|
{{template "shared/user/authorlink" .Poster}}
|
|
{{if gt .OldMilestoneID 0}}{{if gt .MilestoneID 0}}{{ctx.Locale.Tr "repo.issues.change_milestone_at" .OldMilestone.Name .Milestone.Name $createdStr}}{{else}}{{ctx.Locale.Tr "repo.issues.remove_milestone_at" .OldMilestone.Name $createdStr}}{{end}}{{else if gt .MilestoneID 0}}{{ctx.Locale.Tr "repo.issues.add_milestone_at" .Milestone.Name $createdStr}}{{end}}
|
|
</span>
|
|
</div>
|
|
{{else if and (eq .Type 9) (gt .AssigneeID 0)}}
|
|
<div class="timeline-item event" id="{{.HashTag}}">
|
|
<span class="badge">{{svg "octicon-person"}}</span>
|
|
{{if .RemovedAssignee}}
|
|
{{template "shared/user/avatarlink" dict "user" .Assignee}}
|
|
<span class="text grey muted-links">
|
|
{{template "shared/user/authorlink" .Assignee}}
|
|
{{if eq .Poster.ID .Assignee.ID}}
|
|
{{ctx.Locale.Tr "repo.issues.remove_self_assignment" $createdStr}}
|
|
{{else}}
|
|
{{ctx.Locale.Tr "repo.issues.remove_assignee_at" .Poster.GetDisplayName $createdStr}}
|
|
{{end}}
|
|
</span>
|
|
{{else}}
|
|
{{template "shared/user/avatarlink" dict "user" .Assignee}}
|
|
<span class="text grey muted-links">
|
|
{{template "shared/user/authorlink" .Assignee}}
|
|
{{if eq .Poster.ID .AssigneeID}}
|
|
{{ctx.Locale.Tr "repo.issues.self_assign_at" $createdStr}}
|
|
{{else}}
|
|
{{ctx.Locale.Tr "repo.issues.add_assignee_at" .Poster.GetDisplayName $createdStr}}
|
|
{{end}}
|
|
</span>
|
|
{{end}}
|
|
</div>
|
|
{{else if eq .Type 10}}
|
|
<div class="timeline-item event" id="{{.HashTag}}">
|
|
<span class="badge">{{svg "octicon-pencil"}}</span>
|
|
{{template "shared/user/avatarlink" dict "user" .Poster}}
|
|
<span class="text grey muted-links">
|
|
{{template "shared/user/authorlink" .Poster}}
|
|
{{ctx.Locale.Tr "repo.issues.change_title_at" (.OldTitle|RenderEmoji $.Context) (.NewTitle|RenderEmoji $.Context) $createdStr}}
|
|
</span>
|
|
</div>
|
|
{{else if eq .Type 11}}
|
|
<div class="timeline-item event" id="{{.HashTag}}">
|
|
<span class="badge">{{svg "octicon-git-branch"}}</span>
|
|
{{template "shared/user/avatarlink" dict "user" .Poster}}
|
|
<span class="text grey muted-links">
|
|
{{template "shared/user/authorlink" .Poster}}
|
|
{{ctx.Locale.Tr "repo.issues.delete_branch_at" .OldRef $createdStr}}
|
|
</span>
|
|
</div>
|
|
{{else if eq .Type 12}}
|
|
<div class="timeline-item event" id="{{.HashTag}}">
|
|
<span class="badge">{{svg "octicon-clock"}}</span>
|
|
{{template "shared/user/avatarlink" dict "user" .Poster}}
|
|
<span class="text grey muted-links">
|
|
{{template "shared/user/authorlink" .Poster}}
|
|
{{ctx.Locale.Tr "repo.issues.start_tracking_history" $createdStr}}
|
|
</span>
|
|
</div>
|
|
{{else if eq .Type 13}}
|
|
<div class="timeline-item event" id="{{.HashTag}}">
|
|
<span class="badge">{{svg "octicon-clock"}}</span>
|
|
{{template "shared/user/avatarlink" dict "user" .Poster}}
|
|
<span class="text grey muted-links">
|
|
{{template "shared/user/authorlink" .Poster}}
|
|
{{ctx.Locale.Tr "repo.issues.stop_tracking_history" $createdStr}}
|
|
</span>
|
|
{{template "repo/issue/view_content/comments_delete_time" dict "ctxData" $ "comment" .}}
|
|
<div class="detail flex-text-block">
|
|
{{svg "octicon-clock"}}
|
|
{{if .RenderedContent}}
|
|
{{/* compatibility with time comments made before v1.21 */}}
|
|
<span class="text grey muted-links">{{.RenderedContent}}</span>
|
|
{{else}}
|
|
<span class="text grey muted-links">{{.Content|Sec2Time}}</span>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
{{else if eq .Type 14}}
|
|
<div class="timeline-item event" id="{{.HashTag}}">
|
|
<span class="badge">{{svg "octicon-clock"}}</span>
|
|
{{template "shared/user/avatarlink" dict "user" .Poster}}
|
|
<span class="text grey muted-links">
|
|
{{template "shared/user/authorlink" .Poster}}
|
|
{{ctx.Locale.Tr "repo.issues.add_time_history" $createdStr}}
|
|
</span>
|
|
{{template "repo/issue/view_content/comments_delete_time" dict "ctxData" $ "comment" .}}
|
|
<div class="detail flex-text-block">
|
|
{{svg "octicon-clock"}}
|
|
{{if .RenderedContent}}
|
|
{{/* compatibility with time comments made before v1.21 */}}
|
|
<span class="text grey muted-links">{{.RenderedContent}}</span>
|
|
{{else}}
|
|
<span class="text grey muted-links">{{.Content|Sec2Time}}</span>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
{{else if eq .Type 15}}
|
|
<div class="timeline-item event" id="{{.HashTag}}">
|
|
<span class="badge">{{svg "octicon-clock"}}</span>
|
|
{{template "shared/user/avatarlink" dict "user" .Poster}}
|
|
<span class="text grey muted-links">
|
|
{{template "shared/user/authorlink" .Poster}}
|
|
{{ctx.Locale.Tr "repo.issues.cancel_tracking_history" $createdStr}}
|
|
</span>
|
|
</div>
|
|
{{else if eq .Type 16}}
|
|
<div class="timeline-item event" id="{{.HashTag}}">
|
|
<span class="badge">{{svg "octicon-clock"}}</span>
|
|
{{template "shared/user/avatarlink" dict "user" .Poster}}
|
|
<span class="text grey muted-links">
|
|
{{template "shared/user/authorlink" .Poster}}
|
|
{{ctx.Locale.Tr "repo.issues.due_date_added" (DateTime "long" .Content) $createdStr}}
|
|
</span>
|
|
</div>
|
|
{{else if eq .Type 17}}
|
|
<div class="timeline-item event" id="{{.HashTag}}">
|
|
<span class="badge">{{svg "octicon-clock"}}</span>
|
|
{{template "shared/user/avatarlink" dict "user" .Poster}}
|
|
<span class="text grey muted-links">
|
|
{{template "shared/user/authorlink" .Poster}}
|
|
{{$parsedDeadline := StringUtils.Split .Content "|"}}
|
|
{{if eq (len $parsedDeadline) 2}}
|
|
{{$from := DateTime "long" (index $parsedDeadline 1)}}
|
|
{{$to := DateTime "long" (index $parsedDeadline 0)}}
|
|
{{ctx.Locale.Tr "repo.issues.due_date_modified" $to $from $createdStr}}
|
|
{{end}}
|
|
</span>
|
|
</div>
|
|
{{else if eq .Type 18}}
|
|
<div class="timeline-item event" id="{{.HashTag}}">
|
|
<span class="badge">{{svg "octicon-clock"}}</span>
|
|
{{template "shared/user/avatarlink" dict "user" .Poster}}
|
|
<span class="text grey muted-links">
|
|
{{template "shared/user/authorlink" .Poster}}
|
|
{{ctx.Locale.Tr "repo.issues.due_date_remove" (DateTime "long" .Content) $createdStr}}
|
|
</span>
|
|
</div>
|
|
{{else if eq .Type 19}}
|
|
<div class="timeline-item event" id="{{.HashTag}}">
|
|
<span class="badge">{{svg "octicon-package-dependents"}}</span>
|
|
{{template "shared/user/avatarlink" dict "user" .Poster}}
|
|
<span class="text grey muted-links">
|
|
{{template "shared/user/authorlink" .Poster}}
|
|
{{ctx.Locale.Tr "repo.issues.dependency.added_dependency" $createdStr}}
|
|
</span>
|
|
{{if .DependentIssue}}
|
|
<div class="detail flex-text-block">
|
|
{{svg "octicon-plus"}}
|
|
<span class="text grey muted-links">
|
|
<a href="{{.DependentIssue.Link}}">
|
|
{{if eq .DependentIssue.RepoID .Issue.RepoID}}
|
|
#{{.DependentIssue.Index}} {{.DependentIssue.Title}}
|
|
{{else}}
|
|
{{.DependentIssue.Repo.FullName}}#{{.DependentIssue.Index}} - {{.DependentIssue.Title}}
|
|
{{end}}
|
|
</a>
|
|
</span>
|
|
</div>
|
|
{{end}}
|
|
</div>
|
|
{{else if eq .Type 20}}
|
|
<div class="timeline-item event" id="{{.HashTag}}">
|
|
<span class="badge">{{svg "octicon-package-dependents"}}</span>
|
|
{{template "shared/user/avatarlink" dict "user" .Poster}}
|
|
<span class="text grey muted-links">
|
|
{{template "shared/user/authorlink" .Poster}}
|
|
{{ctx.Locale.Tr "repo.issues.dependency.removed_dependency" $createdStr}}
|
|
</span>
|
|
{{if .DependentIssue}}
|
|
<div class="detail flex-text-block">
|
|
{{svg "octicon-trash"}}
|
|
<span class="text grey muted-links">
|
|
<a href="{{.DependentIssue.Link}}">
|
|
{{if eq .DependentIssue.RepoID .Issue.RepoID}}
|
|
#{{.DependentIssue.Index}} {{.DependentIssue.Title}}
|
|
{{else}}
|
|
{{.DependentIssue.Repo.FullName}}#{{.DependentIssue.Index}} - {{.DependentIssue.Title}}
|
|
{{end}}
|
|
</a>
|
|
</span>
|
|
</div>
|
|
{{end}}
|
|
</div>
|
|
{{else if eq .Type 22}}
|
|
<div class="timeline-item-group" id="{{.HashTag}}">
|
|
<div class="timeline-item event">
|
|
{{$reviewType := -1}}
|
|
{{if .Review}}{{$reviewType = .Review.Type}}{{end}}
|
|
{{if not .OriginalAuthor}}
|
|
{{/* Some timeline avatars need a offset to correctly align with their speech bubble.
|
|
The condition depends on whether the comment has contents/attachments or reviews */}}
|
|
<a class="timeline-avatar{{if or .Content .Attachments (and .Review .Review.CodeComments)}} timeline-avatar-offset{{end}}"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>
|
|
{{ctx.AvatarUtils.Avatar .Poster 40}}
|
|
</a>
|
|
{{end}}
|
|
<span class="badge{{if eq $reviewType 1}} tw-bg-green tw-text-white{{else if eq $reviewType 3}} tw-bg-red tw-text-white{{end}}">
|
|
{{if .Review}}{{svg (printf "octicon-%s" .Review.Type.Icon)}}{{end}}
|
|
</span>
|
|
<span class="text grey muted-links">
|
|
{{template "repo/issue/view_content/comments_authorlink" dict "ctxData" $ "comment" .}}
|
|
{{if eq $reviewType 1}}
|
|
{{ctx.Locale.Tr "repo.issues.review.approve" $createdStr}}
|
|
{{else if eq $reviewType 2}}
|
|
{{ctx.Locale.Tr "repo.issues.review.comment" $createdStr}}
|
|
{{else if eq $reviewType 3}}
|
|
{{ctx.Locale.Tr "repo.issues.review.reject" $createdStr}}
|
|
{{else}}
|
|
{{ctx.Locale.Tr "repo.issues.review.comment" $createdStr}}
|
|
{{end}}
|
|
{{if and .Review .Review.Dismissed}}
|
|
<div class="ui small label">{{ctx.Locale.Tr "repo.issues.review.dismissed_label"}}</div>
|
|
{{end}}
|
|
</span>
|
|
</div>
|
|
{{if or .Content .Attachments}}
|
|
<div class="timeline-item comment">
|
|
<div class="content comment-container">
|
|
<div class="ui top attached header comment-header tw-flex tw-items-center tw-justify-between">
|
|
<div class="comment-header-left tw-flex tw-items-center">
|
|
{{if gt .Poster.ID 0}}
|
|
<a class="inline-timeline-avatar" href="{{.Poster.HomeLink}}">
|
|
{{ctx.AvatarUtils.Avatar .Poster 24}}
|
|
</a>
|
|
{{end}}
|
|
<span class="text grey muted-links">
|
|
{{if .OriginalAuthor}}
|
|
<span class="text black tw-font-semibold">
|
|
{{svg (MigrationIcon $.Repository.GetOriginalURLHostname)}}
|
|
{{.OriginalAuthor}}
|
|
</span>
|
|
<span class="text grey muted-links"> {{if $.Repository.OriginalURL}}</span>
|
|
<span class="text migrate">({{ctx.Locale.Tr "repo.migrated_from" $.Repository.OriginalURL $.Repository.GetOriginalURLHostname}}){{end}}</span>
|
|
{{else}}
|
|
{{template "shared/user/authorlink" .Poster}}
|
|
{{end}}
|
|
|
|
{{ctx.Locale.Tr "repo.issues.review.left_comment"}}
|
|
</span>
|
|
</div>
|
|
<div class="comment-header-right actions tw-flex tw-items-center">
|
|
{{template "repo/issue/view_content/show_role" dict "ShowRole" .ShowRole}}
|
|
{{if not $.Repository.IsArchived}}
|
|
{{template "repo/issue/view_content/add_reaction" dict "ctxData" $ "ActionURL" (printf "%s/comments/%d/reactions" $.RepoLink .ID)}}
|
|
{{template "repo/issue/view_content/context_menu" dict "ctxData" $ "item" . "delete" false "issue" true "diff" false "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}}
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
<div class="ui attached segment comment-body">
|
|
<div class="render-content markup" {{if or $.Permission.IsAdmin $.HasIssuesOrPullsWritePermission (and $.IsSigned (eq $.SignedUserID .PosterID))}}data-can-edit="true"{{end}}>
|
|
{{if .RenderedContent}}
|
|
{{.RenderedContent}}
|
|
{{else}}
|
|
<span class="no-content">{{ctx.Locale.Tr "repo.issues.no_content"}}</span>
|
|
{{end}}
|
|
</div>
|
|
<div id="issuecomment-{{.ID}}-raw" class="raw-content tw-hidden">{{.Content}}</div>
|
|
<div class="edit-content-zone tw-hidden" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div>
|
|
{{if .Attachments}}
|
|
{{template "repo/issue/view_content/attachments" dict "Attachments" .Attachments "RenderedContent" .RenderedContent}}
|
|
{{end}}
|
|
</div>
|
|
{{$reactions := .Reactions.GroupByType}}
|
|
{{if $reactions}}
|
|
{{template "repo/issue/view_content/reactions" dict "ctxData" $ "ActionURL" (printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}}
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
{{end}}
|
|
|
|
{{if and .Review .Review.CodeComments}}
|
|
<div class="timeline-item event">
|
|
{{range $filename, $lines := .Review.CodeComments}}
|
|
{{range $line, $comms := $lines}}
|
|
{{template "repo/issue/view_content/conversation" dict "." $ "comments" $comms}}
|
|
{{end}}
|
|
{{end}}
|
|
</div>
|
|
{{end}}
|
|
</div>
|
|
{{else if eq .Type 23}}
|
|
<div class="timeline-item event" id="{{.HashTag}}">
|
|
<span class="badge">{{svg "octicon-lock"}}</span>
|
|
{{template "shared/user/avatarlink" dict "user" .Poster}}
|
|
{{if .Content}}
|
|
<span class="text grey muted-links">
|
|
{{template "shared/user/authorlink" .Poster}}
|
|
{{ctx.Locale.Tr "repo.issues.lock_with_reason" .Content $createdStr}}
|
|
</span>
|
|
{{else}}
|
|
<span class="text grey muted-links">
|
|
{{template "shared/user/authorlink" .Poster}}
|
|
{{ctx.Locale.Tr "repo.issues.lock_no_reason" $createdStr}}
|
|
</span>
|
|
{{end}}
|
|
</div>
|
|
{{else if eq .Type 24}}
|
|
<div class="timeline-item event" id="{{.HashTag}}">
|
|
<span class="badge">{{svg "octicon-key"}}</span>
|
|
{{template "shared/user/avatarlink" dict "user" .Poster}}
|
|
<span class="text grey muted-links">
|
|
{{template "shared/user/authorlink" .Poster}}
|
|
{{ctx.Locale.Tr "repo.issues.unlock_comment" $createdStr}}
|
|
</span>
|
|
</div>
|
|
{{else if eq .Type 25}}
|
|
<div class="timeline-item event">
|
|
<span class="badge">{{svg "octicon-git-branch"}}</span>
|
|
{{if not .OriginalAuthor}}
|
|
{{template "shared/user/avatarlink" dict "user" .Poster}}
|
|
{{end}}
|
|
<span class="text grey muted-links">
|
|
{{template "repo/issue/view_content/comments_authorlink" dict "ctxData" $ "comment" .}}
|
|
{{ctx.Locale.Tr "repo.pulls.change_target_branch_at" .OldRef .NewRef $createdStr}}
|
|
</span>
|
|
</div>
|
|
{{else if eq .Type 26}}
|
|
<div class="timeline-item event" id="{{.HashTag}}">
|
|
<span class="badge">{{svg "octicon-clock"}}</span>
|
|
{{template "shared/user/avatarlink" dict "user" .Poster}}
|
|
<span class="text grey muted-links">
|
|
{{template "shared/user/authorlink" .Poster}}
|
|
|
|
{{ctx.Locale.Tr "repo.issues.del_time_history" $createdStr}}
|
|
</span>
|
|
<div class="detail flex-text-block">
|
|
{{svg "octicon-clock"}}
|
|
{{if .RenderedContent}}
|
|
{{/* compatibility with time comments made before v1.21 */}}
|
|
<span class="text grey muted-links">{{.RenderedContent}}</span>
|
|
{{else}}
|
|
<span class="text grey muted-links">- {{.Content|Sec2Time}}</span>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
{{else if eq .Type 27}}
|
|
<div class="timeline-item event" id="{{.HashTag}}">
|
|
<span class="badge">{{svg "octicon-eye"}}</span>
|
|
{{template "shared/user/avatarlink" dict "user" .Poster}}
|
|
<span class="text grey muted-links">
|
|
{{template "shared/user/authorlink" .Poster}}
|
|
{{if (gt .AssigneeID 0)}}
|
|
{{if .RemovedAssignee}}
|
|
{{if eq .PosterID .AssigneeID}}
|
|
{{ctx.Locale.Tr "repo.issues.review.remove_review_request_self" $createdStr}}
|
|
{{else}}
|
|
{{ctx.Locale.Tr "repo.issues.review.remove_review_request" .Assignee.GetDisplayName $createdStr}}
|
|
{{end}}
|
|
{{else}}
|
|
{{ctx.Locale.Tr "repo.issues.review.add_review_request" .Assignee.GetDisplayName $createdStr}}
|
|
{{end}}
|
|
{{else}}
|
|
<!-- If the assigned team is deleted, just displaying "Ghost Team" in the comment -->
|
|
{{$teamName := "Ghost Team"}}
|
|
{{if .AssigneeTeam}}
|
|
{{$teamName = .AssigneeTeam.Name}}
|
|
{{end}}
|
|
{{if .RemovedAssignee}}
|
|
{{ctx.Locale.Tr "repo.issues.review.remove_review_request" $teamName $createdStr}}
|
|
{{else}}
|
|
{{ctx.Locale.Tr "repo.issues.review.add_review_request" $teamName $createdStr}}
|
|
{{end}}
|
|
{{end}}
|
|
</span>
|
|
</div>
|
|
{{else if and (eq .Type 29) (or (gt .CommitsNum 0) .IsForcePush)}}
|
|
<!-- If PR is closed, the comments whose type is CommentTypePullRequestPush(29) after latestCloseCommentID won't be rendered. //-->
|
|
{{if and .Issue.IsClosed (gt .ID $.LatestCloseCommentID)}}
|
|
{{continue}}
|
|
{{end}}
|
|
<div class="timeline-item event" id="{{.HashTag}}">
|
|
<span class="badge">{{svg "octicon-repo-push"}}</span>
|
|
<span class="text grey muted-links">
|
|
{{template "shared/user/authorlink" .Poster}}
|
|
{{if .IsForcePush}}
|
|
{{ctx.Locale.Tr "repo.issues.force_push_codes" $.Issue.PullRequest.HeadBranch (ShortSha .OldCommit) ($.Issue.Repo.CommitLink .OldCommit) (ShortSha .NewCommit) ($.Issue.Repo.CommitLink .NewCommit) $createdStr}}
|
|
{{else}}
|
|
{{ctx.Locale.TrN (len .Commits) "repo.issues.push_commit_1" "repo.issues.push_commits_n" (len .Commits) $createdStr}}
|
|
{{end}}
|
|
</span>
|
|
{{if and .IsForcePush $.Issue.PullRequest.BaseRepo.Name}}
|
|
<span class="tw-float-right comparebox">
|
|
<a href="{{$.Issue.PullRequest.BaseRepo.Link}}/compare/{{PathEscape .OldCommit}}..{{PathEscape .NewCommit}}" rel="nofollow" class="ui compare label">{{ctx.Locale.Tr "repo.issues.force_push_compare"}}</a>
|
|
</span>
|
|
{{end}}
|
|
</div>
|
|
{{if not .IsForcePush}}
|
|
{{template "repo/commits_list_small" dict "comment" . "root" $}}
|
|
{{end}}
|
|
{{else if eq .Type 30}}
|
|
{{if not $.UnitProjectsGlobalDisabled}}
|
|
<div class="timeline-item event" id="{{.HashTag}}">
|
|
<span class="badge">{{svg "octicon-project"}}</span>
|
|
{{template "shared/user/avatarlink" dict "user" .Poster}}
|
|
<span class="text grey muted-links">
|
|
{{template "shared/user/authorlink" .Poster}}
|
|
{{$oldProjectDisplayHtml := "Unknown Project"}}
|
|
{{if .OldProject}}
|
|
{{$trKey := printf "projects.type-%d.display_name" .OldProject.Type}}
|
|
{{$oldProjectDisplayHtml = HTMLFormat `<span data-tooltip-content="%s">%s</span>` (ctx.Locale.Tr $trKey) .OldProject.Title}}
|
|
{{end}}
|
|
{{$newProjectDisplayHtml := "Unknown Project"}}
|
|
{{if .Project}}
|
|
{{$trKey := printf "projects.type-%d.display_name" .Project.Type}}
|
|
{{$newProjectDisplayHtml = HTMLFormat `<span data-tooltip-content="%s">%s</span>` (ctx.Locale.Tr $trKey) .Project.Title}}
|
|
{{end}}
|
|
{{if and (gt .OldProjectID 0) (gt .ProjectID 0)}}
|
|
{{ctx.Locale.Tr "repo.issues.change_project_at" $oldProjectDisplayHtml $newProjectDisplayHtml $createdStr}}
|
|
{{else if gt .OldProjectID 0}}
|
|
{{ctx.Locale.Tr "repo.issues.remove_project_at" $oldProjectDisplayHtml $createdStr}}
|
|
{{else if gt .ProjectID 0}}
|
|
{{ctx.Locale.Tr "repo.issues.add_project_at" $newProjectDisplayHtml $createdStr}}
|
|
{{end}}
|
|
</span>
|
|
</div>
|
|
{{end}}
|
|
{{else if eq .Type 32}}
|
|
<div class="timeline-item-group">
|
|
<div class="timeline-item event" id="{{.HashTag}}">
|
|
<a class="timeline-avatar"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>
|
|
<img src="{{.Poster.AvatarLink $.Context}}" width="40" height="40">
|
|
</a>
|
|
<span class="badge grey">{{svg "octicon-x" 16}}</span>
|
|
<span class="text grey muted-links">
|
|
{{template "shared/user/authorlink" .Poster}}
|
|
{{$reviewerName := ""}}
|
|
{{if .Review}}
|
|
{{if eq .Review.OriginalAuthor ""}}
|
|
{{$reviewerName = .Review.Reviewer.Name}}
|
|
{{else}}
|
|
{{$reviewerName = .Review.OriginalAuthor}}
|
|
{{end}}
|
|
{{end}}
|
|
{{ctx.Locale.Tr "repo.issues.review.dismissed" $reviewerName $createdStr}}
|
|
</span>
|
|
</div>
|
|
{{if .Content}}
|
|
<div class="timeline-item comment">
|
|
<div class="content">
|
|
<div class="ui top attached header comment-header-left tw-flex tw-items-center arrow-top">
|
|
{{if gt .Poster.ID 0}}
|
|
<a class="inline-timeline-avatar" href="{{.Poster.HomeLink}}">
|
|
{{ctx.AvatarUtils.Avatar .Poster 24}}
|
|
</a>
|
|
{{end}}
|
|
<span class="text grey muted-links">
|
|
{{ctx.Locale.Tr "action.review_dismissed_reason"}}
|
|
</span>
|
|
</div>
|
|
<div class="ui attached segment">
|
|
<div class="render-content markup">
|
|
{{if .RenderedContent}}
|
|
{{.RenderedContent}}
|
|
{{else}}
|
|
<span class="no-content">{{ctx.Locale.Tr "repo.issues.no_content"}}</span>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{{end}}
|
|
</div>
|
|
{{else if eq .Type 33}}
|
|
<div class="timeline-item event" id="{{.HashTag}}">
|
|
<span class="badge">{{svg "octicon-git-branch"}}</span>
|
|
{{template "shared/user/avatarlink" dict "user" .Poster}}
|
|
<span class="text grey muted-links">
|
|
{{template "shared/user/authorlink" .Poster}}
|
|
{{if and .OldRef .NewRef}}
|
|
{{ctx.Locale.Tr "repo.issues.change_ref_at" .OldRef .NewRef $createdStr}}
|
|
{{else if .OldRef}}
|
|
{{ctx.Locale.Tr "repo.issues.remove_ref_at" .OldRef $createdStr}}
|
|
{{else}}
|
|
{{ctx.Locale.Tr "repo.issues.add_ref_at" .NewRef $createdStr}}
|
|
{{end}}
|
|
</span>
|
|
</div>
|
|
{{else if or (eq .Type 34) (eq .Type 35)}}
|
|
<div class="timeline-item event" id="{{.HashTag}}">
|
|
<span class="badge">{{svg "octicon-git-merge" 16}}</span>
|
|
<span class="text grey muted-links">
|
|
{{template "repo/issue/view_content/comments_authorlink" dict "ctxData" $ "comment" .}}
|
|
{{if eq .Type 34}}{{ctx.Locale.Tr "repo.pulls.auto_merge_newly_scheduled_comment" $createdStr}}
|
|
{{else}}{{ctx.Locale.Tr "repo.pulls.auto_merge_canceled_schedule_comment" $createdStr}}{{end}}
|
|
</span>
|
|
</div>
|
|
{{else if or (eq .Type 36) (eq .Type 37)}}
|
|
<div class="timeline-item event" id="{{.HashTag}}">
|
|
<span class="badge">{{svg "octicon-pin" 16}}</span>
|
|
{{template "shared/user/avatarlink" dict "user" .Poster}}
|
|
<span class="text grey muted-links">
|
|
{{template "shared/user/authorlink" .Poster}}
|
|
{{if eq .Type 36}}{{ctx.Locale.Tr "repo.issues.pin_comment" $createdStr}}
|
|
{{else}}{{ctx.Locale.Tr "repo.issues.unpin_comment" $createdStr}}{{end}}
|
|
</span>
|
|
</div>
|
|
{{end}}
|
|
{{end}}
|
|
{{end}}
|