From 06268dcf53657ffe012abe878e1127ab4f954264 Mon Sep 17 00:00:00 2001 From: Cirno the Strongest <1447794+CirnoT@users.noreply.github.com> Date: Mon, 2 Nov 2020 09:56:02 +0100 Subject: [PATCH] Fix reactions on code comments (#13390) Co-authored-by: Lunny Xiao --- models/issue_comment.go | 4 ++++ templates/repo/diff/comments.tmpl | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/models/issue_comment.go b/models/issue_comment.go index 63256ddc99..a7e9c049bf 100644 --- a/models/issue_comment.go +++ b/models/issue_comment.go @@ -1111,6 +1111,10 @@ func fetchCodeCommentsByReview(e Engine, issue *Issue, currentUser *User, review return nil, err } + if err := comment.LoadReactions(issue.Repo); err != nil { + return nil, err + } + if re, ok := reviews[comment.ReviewID]; ok && re != nil { // If the review is pending only the author can see the comments (except the review is set) if review.ID == 0 { diff --git a/templates/repo/diff/comments.tmpl b/templates/repo/diff/comments.tmpl index cf4bd64cf9..205dd97c24 100644 --- a/templates/repo/diff/comments.tmpl +++ b/templates/repo/diff/comments.tmpl @@ -46,7 +46,7 @@ {{end}} {{end}} - {{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.root.RepoLink .ID) }} + {{template "repo/issue/view_content/add_reaction" Dict "ctx" $.root "ActionURL" (Printf "%s/comments/%d/reactions" $.root.RepoLink .ID) }} {{template "repo/issue/view_content/context_menu" Dict "ctx" $.root "item" . "delete" true "diff" true "IsCommentPoster" (and $.root.IsSigned (eq $.root.SignedUserID .PosterID))}} @@ -64,7 +64,7 @@ {{$reactions := .Reactions.GroupByType}} {{if $reactions}}
- {{template "repo/issue/view_content/reactions" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.root.RepoLink .ID) "Reactions" $reactions}} + {{template "repo/issue/view_content/reactions" Dict "ctx" $.root "ActionURL" (Printf "%s/comments/%d/reactions" $.root.RepoLink .ID) "Reactions" $reactions}}
{{end}}