|
|
@ -40,6 +40,8 @@ const ( |
|
|
|
CommentTypeLabel |
|
|
|
CommentTypeLabel |
|
|
|
// Milestone changed
|
|
|
|
// Milestone changed
|
|
|
|
CommentTypeMilestone |
|
|
|
CommentTypeMilestone |
|
|
|
|
|
|
|
// Assignees changed
|
|
|
|
|
|
|
|
CommentTypeAssignees |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
// CommentTag defines comment tag type
|
|
|
|
// CommentTag defines comment tag type
|
|
|
@ -66,6 +68,11 @@ type Comment struct { |
|
|
|
MilestoneID int64 |
|
|
|
MilestoneID int64 |
|
|
|
OldMilestone *Milestone `xorm:"-"` |
|
|
|
OldMilestone *Milestone `xorm:"-"` |
|
|
|
Milestone *Milestone `xorm:"-"` |
|
|
|
Milestone *Milestone `xorm:"-"` |
|
|
|
|
|
|
|
OldAssigneeID int64 |
|
|
|
|
|
|
|
AssigneeID int64 |
|
|
|
|
|
|
|
Assignee *User `xorm:"-"` |
|
|
|
|
|
|
|
OldAssignee *User `xorm:"-"` |
|
|
|
|
|
|
|
|
|
|
|
CommitID int64 |
|
|
|
CommitID int64 |
|
|
|
Line int64 |
|
|
|
Line int64 |
|
|
|
Content string `xorm:"TEXT"` |
|
|
|
Content string `xorm:"TEXT"` |
|
|
@ -240,6 +247,25 @@ func (c *Comment) LoadMilestone() error { |
|
|
|
return nil |
|
|
|
return nil |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// LoadAssignees if comment.Type is CommentTypeAssignees, then load assignees
|
|
|
|
|
|
|
|
func (c *Comment) LoadAssignees() error { |
|
|
|
|
|
|
|
var err error |
|
|
|
|
|
|
|
if c.OldAssigneeID > 0 { |
|
|
|
|
|
|
|
c.OldAssignee, err = getUserByID(x, c.OldAssigneeID) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
|
|
return err |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if c.AssigneeID > 0 { |
|
|
|
|
|
|
|
c.Assignee, err = getUserByID(x, c.AssigneeID) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
|
|
return err |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return nil |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// MailParticipants sends new comment emails to repository watchers
|
|
|
|
// MailParticipants sends new comment emails to repository watchers
|
|
|
|
// and mentioned people.
|
|
|
|
// and mentioned people.
|
|
|
|
func (c *Comment) MailParticipants(e Engine, opType ActionType, issue *Issue) (err error) { |
|
|
|
func (c *Comment) MailParticipants(e Engine, opType ActionType, issue *Issue) (err error) { |
|
|
@ -276,6 +302,8 @@ func createComment(e *xorm.Session, opts *CreateCommentOptions) (_ *Comment, err |
|
|
|
LabelID: LabelID, |
|
|
|
LabelID: LabelID, |
|
|
|
OldMilestoneID: opts.OldMilestoneID, |
|
|
|
OldMilestoneID: opts.OldMilestoneID, |
|
|
|
MilestoneID: opts.MilestoneID, |
|
|
|
MilestoneID: opts.MilestoneID, |
|
|
|
|
|
|
|
OldAssigneeID: opts.OldAssigneeID, |
|
|
|
|
|
|
|
AssigneeID: opts.AssigneeID, |
|
|
|
CommitID: opts.CommitID, |
|
|
|
CommitID: opts.CommitID, |
|
|
|
CommitSHA: opts.CommitSHA, |
|
|
|
CommitSHA: opts.CommitSHA, |
|
|
|
Line: opts.LineNum, |
|
|
|
Line: opts.LineNum, |
|
|
@ -416,6 +444,17 @@ func createMilestoneComment(e *xorm.Session, doer *User, repo *Repository, issue |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func createAssigneeComment(e *xorm.Session, doer *User, repo *Repository, issue *Issue, oldAssigneeID, assigneeID int64) (*Comment, error) { |
|
|
|
|
|
|
|
return createComment(e, &CreateCommentOptions{ |
|
|
|
|
|
|
|
Type: CommentTypeAssignees, |
|
|
|
|
|
|
|
Doer: doer, |
|
|
|
|
|
|
|
Repo: repo, |
|
|
|
|
|
|
|
Issue: issue, |
|
|
|
|
|
|
|
OldAssigneeID: oldAssigneeID, |
|
|
|
|
|
|
|
AssigneeID: assigneeID, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// CreateCommentOptions defines options for creating comment
|
|
|
|
// CreateCommentOptions defines options for creating comment
|
|
|
|
type CreateCommentOptions struct { |
|
|
|
type CreateCommentOptions struct { |
|
|
|
Type CommentType |
|
|
|
Type CommentType |
|
|
@ -426,6 +465,8 @@ type CreateCommentOptions struct { |
|
|
|
|
|
|
|
|
|
|
|
OldMilestoneID int64 |
|
|
|
OldMilestoneID int64 |
|
|
|
MilestoneID int64 |
|
|
|
MilestoneID int64 |
|
|
|
|
|
|
|
OldAssigneeID int64 |
|
|
|
|
|
|
|
AssigneeID int64 |
|
|
|
CommitID int64 |
|
|
|
CommitID int64 |
|
|
|
CommitSHA string |
|
|
|
CommitSHA string |
|
|
|
LineNum int64 |
|
|
|
LineNum int64 |
|
|
|