Skip to content
/ gitea Public
forked from go-gitea/gitea

Commit

Permalink
Fix reactions on code comments (go-gitea#13390)
Browse files Browse the repository at this point in the history
Co-authored-by: Lunny Xiao <[email protected]>

(cherry picked from commit 06268dc)
  • Loading branch information
CirnoT committed Nov 2, 2020
1 parent 02259a0 commit e193f10
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions models/issue_comment.go
Original file line number Diff line number Diff line change
Expand Up @@ -1124,6 +1124,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 {
Expand Down
4 changes: 2 additions & 2 deletions templates/repo/diff/comments.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,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>
Expand All @@ -48,7 +48,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>
Expand Down

0 comments on commit e193f10

Please sign in to comment.