mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Merge branch 'master' into feat/approval-new
# Conflicts: # models/issue_comment.go # models/migrations/migrations.go # models/migrations/v64.go # models/models.go # public/css/index.css
This commit is contained in:
@@ -88,23 +88,22 @@ const (
|
||||
|
||||
// Comment represents a comment in commit and issue page.
|
||||
type Comment struct {
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
Type CommentType
|
||||
PosterID int64 `xorm:"INDEX"`
|
||||
Poster *User `xorm:"-"`
|
||||
IssueID int64 `xorm:"INDEX"`
|
||||
LabelID int64
|
||||
Label *Label `xorm:"-"`
|
||||
OldMilestoneID int64
|
||||
MilestoneID int64
|
||||
OldMilestone *Milestone `xorm:"-"`
|
||||
Milestone *Milestone `xorm:"-"`
|
||||
OldAssigneeID int64
|
||||
AssigneeID int64
|
||||
Assignee *User `xorm:"-"`
|
||||
OldAssignee *User `xorm:"-"`
|
||||
OldTitle string
|
||||
NewTitle string
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
Type CommentType
|
||||
PosterID int64 `xorm:"INDEX"`
|
||||
Poster *User `xorm:"-"`
|
||||
IssueID int64 `xorm:"INDEX"`
|
||||
LabelID int64
|
||||
Label *Label `xorm:"-"`
|
||||
OldMilestoneID int64
|
||||
MilestoneID int64
|
||||
OldMilestone *Milestone `xorm:"-"`
|
||||
Milestone *Milestone `xorm:"-"`
|
||||
AssigneeID int64
|
||||
RemovedAssignee bool
|
||||
Assignee *User `xorm:"-"`
|
||||
OldTitle string
|
||||
NewTitle string
|
||||
|
||||
CommitID int64
|
||||
Line int64 // - previous line / + proposed line
|
||||
@@ -259,18 +258,9 @@ func (c *Comment) LoadMilestone() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// LoadAssignees if comment.Type is CommentTypeAssignees, then load assignees
|
||||
func (c *Comment) LoadAssignees() error {
|
||||
// LoadAssigneeUser if comment.Type is CommentTypeAssignees, then load assignees
|
||||
func (c *Comment) LoadAssigneeUser() error {
|
||||
var err error
|
||||
if c.OldAssigneeID > 0 {
|
||||
c.OldAssignee, err = getUserByID(x, c.OldAssigneeID)
|
||||
if err != nil {
|
||||
if !IsErrUserNotExist(err) {
|
||||
return err
|
||||
}
|
||||
c.OldAssignee = NewGhostUser()
|
||||
}
|
||||
}
|
||||
|
||||
if c.AssigneeID > 0 {
|
||||
c.Assignee, err = getUserByID(x, c.AssigneeID)
|
||||
@@ -382,21 +372,21 @@ func createComment(e *xorm.Session, opts *CreateCommentOptions) (_ *Comment, err
|
||||
LabelID = opts.Label.ID
|
||||
}
|
||||
comment := &Comment{
|
||||
Type: opts.Type,
|
||||
PosterID: opts.Doer.ID,
|
||||
Poster: opts.Doer,
|
||||
IssueID: opts.Issue.ID,
|
||||
LabelID: LabelID,
|
||||
OldMilestoneID: opts.OldMilestoneID,
|
||||
MilestoneID: opts.MilestoneID,
|
||||
OldAssigneeID: opts.OldAssigneeID,
|
||||
AssigneeID: opts.AssigneeID,
|
||||
CommitID: opts.CommitID,
|
||||
CommitSHA: opts.CommitSHA,
|
||||
Line: opts.LineNum,
|
||||
Content: opts.Content,
|
||||
OldTitle: opts.OldTitle,
|
||||
NewTitle: opts.NewTitle,
|
||||
Type: opts.Type,
|
||||
PosterID: opts.Doer.ID,
|
||||
Poster: opts.Doer,
|
||||
IssueID: opts.Issue.ID,
|
||||
LabelID: LabelID,
|
||||
OldMilestoneID: opts.OldMilestoneID,
|
||||
MilestoneID: opts.MilestoneID,
|
||||
RemovedAssignee: opts.RemovedAssignee,
|
||||
AssigneeID: opts.AssigneeID,
|
||||
CommitID: opts.CommitID,
|
||||
CommitSHA: opts.CommitSHA,
|
||||
Line: opts.LineNum,
|
||||
Content: opts.Content,
|
||||
OldTitle: opts.OldTitle,
|
||||
NewTitle: opts.NewTitle,
|
||||
TreePath: opts.TreePath,
|
||||
ReviewID: opts.ReviewID,
|
||||
}
|
||||
@@ -540,14 +530,14 @@ 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) {
|
||||
func createAssigneeComment(e *xorm.Session, doer *User, repo *Repository, issue *Issue, assigneeID int64, removedAssignee bool) (*Comment, error) {
|
||||
return createComment(e, &CreateCommentOptions{
|
||||
Type: CommentTypeAssignees,
|
||||
Doer: doer,
|
||||
Repo: repo,
|
||||
Issue: issue,
|
||||
OldAssigneeID: oldAssigneeID,
|
||||
AssigneeID: assigneeID,
|
||||
Type: CommentTypeAssignees,
|
||||
Doer: doer,
|
||||
Repo: repo,
|
||||
Issue: issue,
|
||||
RemovedAssignee: removedAssignee,
|
||||
AssigneeID: assigneeID,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -608,19 +598,19 @@ type CreateCommentOptions struct {
|
||||
Issue *Issue
|
||||
Label *Label
|
||||
|
||||
OldMilestoneID int64
|
||||
MilestoneID int64
|
||||
OldAssigneeID int64
|
||||
AssigneeID int64
|
||||
OldTitle string
|
||||
NewTitle string
|
||||
CommitID int64
|
||||
CommitSHA string
|
||||
LineNum int64
|
||||
OldMilestoneID int64
|
||||
MilestoneID int64
|
||||
AssigneeID int64
|
||||
RemovedAssignee bool
|
||||
OldTitle string
|
||||
NewTitle string
|
||||
CommitID int64
|
||||
CommitSHA string
|
||||
LineNum int64
|
||||
TreePath string
|
||||
ReviewID int64
|
||||
Content string
|
||||
Attachments []string // UUIDs of attachments
|
||||
Content string
|
||||
Attachments []string // UUIDs of attachments
|
||||
}
|
||||
|
||||
// CreateComment creates comment of issue or commit.
|
||||
|
Reference in New Issue
Block a user