Skip to content

Commit 6d8d5ad

Browse files
committed
Update comments.tmpl
1 parent f65f92c commit 6d8d5ad

File tree

1 file changed

+36
-16
lines changed

1 file changed

+36
-16
lines changed

templates/repo/conversation/comments.tmpl

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
<!-- Provide Issue for any types other than type 0 -->
12
{{template "base/alert"}}
2-
{{range .Issue.Comments}}
3+
{{$IsIssue:= .IsIssue}}
4+
{{$IsCommit:= .IsCommit}}
5+
{{range .Comments}}
36
{{if call $.ShouldShowCommentType .Type}}
47
{{$createdStr:= DateUtils.TimeSince .CreatedUnix}}
58

@@ -53,9 +56,14 @@
5356
<div class="comment-header-right actions tw-flex tw-items-center">
5457
{{template "repo/issue/view_content/show_role" dict "ShowRole" .ShowRole}}
5558
{{if not $.Repository.IsArchived}}
56-
{{template "repo/issue/view_content/add_reaction" dict "ActionURL" (printf "%s/comments/%d/reactions" $.RepoLink .ID)}}
59+
{{if $IsIssue}}
60+
{{template "repo/conversation/add_reaction" dict "ActionURL" (printf "%s/comments/%d/reactions" $.RepoLink .ID)}}
61+
{{else}}
62+
{{template "repo/conversation/add_reaction" dict "ActionURL" (printf "%s/conversations/comments/%d/reactions" $.RepoLink .ID)}}
63+
{{end}}
5764
{{end}}
58-
{{template "repo/issue/view_content/context_menu" dict "item" . "delete" true "issue" true "diff" false "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}}
65+
66+
{{template "repo/conversation/context_menu" dict "ctxData" $ "item" . "delete" true "issue" $IsIssue "pull" ((and $IsIssue .Issue.IsPull)) "commit" $IsCommit "diff" false "IsIssue" $IsIssue "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}}
5967
</div>
6068
</div>
6169
<div class="ui attached segment comment-body" role="article">
@@ -66,15 +74,27 @@
6674
<span class="no-content">{{ctx.Locale.Tr "repo.issues.no_content"}}</span>
6775
{{end}}
6876
</div>
69-
<div id="issuecomment-{{.ID}}-raw" class="raw-content tw-hidden">{{.Content}}</div>
70-
<div class="edit-content-zone tw-hidden" data-update-url="{{$.RepoLink}}/comments/{{.ID}}" data-content-version="{{.ContentVersion}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$.RepoLink}}/comments/{{.ID}}/attachments"></div>
77+
<div id="{{if $IsIssue}}issue{{end}}comment-{{.ID}}-raw" class="raw-content tw-hidden">{{.Content}}</div>
78+
79+
{{if $IsIssue}}
80+
{{$EditURL:=printf "%s/%s/%d" $.RepoLink "comments" .ID}}
81+
<div class="edit-content-zone tw-hidden" data-update-url="{{$EditURL}}" data-content-version="{{.ContentVersion}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$EditURL}}/attachments"></div>
82+
{{else}}
83+
{{$EditURL:=printf "%s/%s/%d" $.RepoLink "conversations/comments" .ID}}
84+
<div class="edit-content-zone tw-hidden" data-update-url="{{$EditURL}}" data-content-version="{{.ContentVersion}}" data-context="{{$.RepoLink}}" data-attachment-url="{{$EditURL}}/attachments"></div>
85+
{{end}}
86+
7187
{{if .Attachments}}
7288
{{template "repo/issue/view_content/attachments" dict "Attachments" .Attachments "RenderedContent" .RenderedContent}}
7389
{{end}}
7490
</div>
7591
{{$reactions := .Reactions.GroupByType}}
7692
{{if $reactions}}
77-
{{template "repo/issue/view_content/reactions" dict "ActionURL" (printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}}
93+
{{if $IsIssue}}
94+
{{template "repo/conversation/reactions" dict "ActionURL" (printf "%s/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}}
95+
{{else}}
96+
{{template "repo/conversation/reactions" dict "ActionURL" (printf "%s/conversations/comments/%d/reactions" $.RepoLink .ID) "Reactions" $reactions}}
97+
{{end}}
7898
{{end}}
7999
</div>
80100
</div>
@@ -85,7 +105,7 @@
85105
{{template "shared/user/avatarlink" dict "user" .Poster}}
86106
{{end}}
87107
<span class="text grey muted-links">
88-
{{template "repo/issue/view_content/comments_authorlink" dict "ctxData" $ "comment" .}}
108+
{{template "repo/conversation/comments_authorlink" dict "ctxData" $ "comment" .}}
89109
{{if .Issue.IsPull}}
90110
{{ctx.Locale.Tr "repo.pulls.reopened_at" .EventTag $createdStr}}
91111
{{else}}
@@ -100,7 +120,7 @@
100120
{{template "shared/user/avatarlink" dict "user" .Poster}}
101121
{{end}}
102122
<span class="text grey muted-links">
103-
{{template "repo/issue/view_content/comments_authorlink" dict "ctxData" $ "comment" .}}
123+
{{template "repo/conversation/comments_authorlink" dict "ctxData" $ "comment" .}}
104124
{{if .Issue.IsPull}}
105125
{{ctx.Locale.Tr "repo.pulls.closed_at" .EventTag $createdStr}}
106126
{{else}}
@@ -115,7 +135,7 @@
115135
{{template "shared/user/avatarlink" dict "user" .Poster}}
116136
{{end}}
117137
<span class="text grey muted-links">
118-
{{template "repo/issue/view_content/comments_authorlink" dict "ctxData" $ "comment" .}}
138+
{{template "repo/conversation/comments_authorlink" dict "ctxData" $ "comment" .}}
119139
{{$link := printf "%s/commit/%s" $.Repository.Link ($.Issue.PullRequest.MergedCommitID|PathEscape)}}
120140
{{if eq $.Issue.PullRequest.Status 3}}
121141
{{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}}
@@ -251,7 +271,7 @@
251271
{{template "shared/user/authorlink" .Poster}}
252272
{{ctx.Locale.Tr "repo.issues.stop_tracking_history" $createdStr}}
253273
</span>
254-
{{template "repo/issue/view_content/comments_delete_time" dict "ctxData" $ "comment" .}}
274+
{{template "repo/conversation/comments_delete_time" dict "ctxData" $ "comment" .}}
255275
<div class="detail flex-text-block">
256276
{{svg "octicon-clock"}}
257277
{{if .RenderedContent}}
@@ -270,7 +290,7 @@
270290
{{template "shared/user/authorlink" .Poster}}
271291
{{ctx.Locale.Tr "repo.issues.add_time_history" $createdStr}}
272292
</span>
273-
{{template "repo/issue/view_content/comments_delete_time" dict "ctxData" $ "comment" .}}
293+
{{template "repo/conversation/comments_delete_time" dict "ctxData" $ "comment" .}}
274294
<div class="detail flex-text-block">
275295
{{svg "octicon-clock"}}
276296
{{if .RenderedContent}}
@@ -386,7 +406,7 @@
386406
{{if .Review}}{{svg (printf "octicon-%s" .Review.Type.Icon)}}{{end}}
387407
</span>
388408
<span class="text grey muted-links">
389-
{{template "repo/issue/view_content/comments_authorlink" dict "ctxData" $ "comment" .}}
409+
{{template "repo/conversation/comments_authorlink" dict "ctxData" $ "comment" .}}
390410
{{if eq $reviewType 1}}
391411
{{ctx.Locale.Tr "repo.issues.review.approve" $createdStr}}
392412
{{else if eq $reviewType 2}}
@@ -429,8 +449,8 @@
429449
<div class="comment-header-right actions tw-flex tw-items-center">
430450
{{template "repo/issue/view_content/show_role" dict "ShowRole" .ShowRole}}
431451
{{if not $.Repository.IsArchived}}
432-
{{template "repo/issue/view_content/add_reaction" dict "ActionURL" (printf "%s/comments/%d/reactions" $.RepoLink .ID)}}
433-
{{template "repo/issue/view_content/context_menu" dict "item" . "delete" false "issue" true "diff" false "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}}
452+
{{template "repo/conversation/add_reaction" dict "ActionURL" (printf "%s/comments/%d/reactions" $.RepoLink .ID)}}
453+
{{template "repo/conversation/context_menu" dict "ctxData" $ "item" . "delete" false "issue" true "diff" false "IsCommentPoster" (and $.IsSigned (eq $.SignedUserID .PosterID))}}
434454
{{end}}
435455
</div>
436456
</div>
@@ -498,7 +518,7 @@
498518
{{template "shared/user/avatarlink" dict "user" .Poster}}
499519
{{end}}
500520
<span class="text grey muted-links">
501-
{{template "repo/issue/view_content/comments_authorlink" dict "ctxData" $ "comment" .}}
521+
{{template "repo/conversation/comments_authorlink" dict "ctxData" $ "comment" .}}
502522
{{ctx.Locale.Tr "repo.pulls.change_target_branch_at" .OldRef .NewRef $createdStr}}
503523
</span>
504524
</div>
@@ -687,7 +707,7 @@
687707
<div class="timeline-item event" id="{{.HashTag}}">
688708
<span class="badge">{{svg "octicon-git-merge" 16}}</span>
689709
<span class="text grey muted-links">
690-
{{template "repo/issue/view_content/comments_authorlink" dict "ctxData" $ "comment" .}}
710+
{{template "repo/conversation/comments_authorlink" dict "ctxData" $ "comment" .}}
691711
{{if eq .Type 34}}{{ctx.Locale.Tr "repo.pulls.auto_merge_newly_scheduled_comment" $createdStr}}
692712
{{else}}{{ctx.Locale.Tr "repo.pulls.auto_merge_canceled_schedule_comment" $createdStr}}{{end}}
693713
</span>

0 commit comments

Comments
 (0)