]> source.dussan.org Git - gitea.git/commitdiff
Fix reactions on code comments (#13390)
authorCirno the Strongest <1447794+CirnoT@users.noreply.github.com>
Mon, 2 Nov 2020 08:56:02 +0000 (09:56 +0100)
committerGitHub <noreply@github.com>
Mon, 2 Nov 2020 08:56:02 +0000 (10:56 +0200)
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
models/issue_comment.go
templates/repo/diff/comments.tmpl

index 63256ddc99f70a967f2fc85ab8e46fee39efff40..a7e9c049bf309efaf81456424de6840e7236814e 100644 (file)
@@ -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 {
index cf4bd64cf99a2a1d533557f198781056c6a826b9..205dd97c240c977b862804c3b2a31da508f1e33d 100644 (file)
@@ -46,7 +46,7 @@
                                                </div>
                                        {{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))}}
                        </div>
                </div>
@@ -64,7 +64,7 @@
                {{$reactions := .Reactions.GroupByType}}
                {{if $reactions}}
                        <div class="ui attached segment 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}}
                        </div>
                {{end}}
        </div>