1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Add reactions to issues/PR and comments (#2856)

This commit is contained in:
Lauris BH
2017-12-04 01:14:26 +02:00
committed by GitHub
parent e59adcde65
commit 5dc37b187c
24 changed files with 677 additions and 8 deletions

View File

@@ -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 {