summaryrefslogtreecommitdiffstats
path: root/models/issue_comment.go
diff options
context:
space:
mode:
authorLauris BH <lauris@nix.lv>2017-12-04 01:14:26 +0200
committerGitHub <noreply@github.com>2017-12-04 01:14:26 +0200
commit5dc37b187c8b839a15ff73758799f218ddeb3bc9 (patch)
treeb63e5ca72c7b9e72c79408ace82dfcba992b5793 /models/issue_comment.go
parente59adcde655aac0e8afd3249407c9a0a2b1b1d6b (diff)
downloadgitea-5dc37b187c8b839a15ff73758799f218ddeb3bc9.tar.gz
gitea-5dc37b187c8b839a15ff73758799f218ddeb3bc9.zip
Add reactions to issues/PR and comments (#2856)
Diffstat (limited to 'models/issue_comment.go')
-rw-r--r--models/issue_comment.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/models/issue_comment.go b/models/issue_comment.go
index 34c0ecdce5..aabeb9c8d4 100644
--- a/models/issue_comment.go
+++ b/models/issue_comment.go
@@ -107,6 +107,7 @@ type Comment struct {
CommitSHA string `xorm:"VARCHAR(40)"`
Attachments []*Attachment `xorm:"-"`
+ Reactions ReactionList `xorm:"-"`
// For view issue page.
ShowTag CommentTag `xorm:"-"`
@@ -287,6 +288,29 @@ func (c *Comment) MailParticipants(e Engine, opType ActionType, issue *Issue) (e
return nil
}
+func (c *Comment) loadReactions(e Engine) (err error) {
+ if c.Reactions != nil {
+ return nil
+ }
+ c.Reactions, err = findReactions(e, FindReactionsOptions{
+ IssueID: c.IssueID,
+ CommentID: c.ID,
+ })
+ if err != nil {
+ return err
+ }
+ // Load reaction user data
+ if _, err := c.Reactions.LoadUsers(); err != nil {
+ return err
+ }
+ return nil
+}
+
+// LoadReactions loads comment reactions
+func (c *Comment) LoadReactions() error {
+ return c.loadReactions(x)
+}
+
func createComment(e *xorm.Session, opts *CreateCommentOptions) (_ *Comment, err error) {
var LabelID int64
if opts.Label != nil {