summaryrefslogtreecommitdiffstats
path: root/models/issue_comment.go
diff options
context:
space:
mode:
authorLanre Adelowo <yo@lanre.wtf>2020-08-17 04:07:38 +0100
committerGitHub <noreply@github.com>2020-08-16 23:07:38 -0400
commit4027c5dd7c11c1256094e202be591ec1b86a011e (patch)
tree49e361a50395f0496c49d52bfd571ee47c1ebf44 /models/issue_comment.go
parentd285b5d35a44bf9fde0682532aeef9550f78cf83 (diff)
downloadgitea-4027c5dd7c11c1256094e202be591ec1b86a011e.tar.gz
gitea-4027c5dd7c11c1256094e202be591ec1b86a011e.zip
Kanban board (#8346)
Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: jaqra <48099350+jaqra@users.noreply.github.com> Co-authored-by: Kerry <flatline-studios@users.noreply.github.com> Co-authored-by: Jaqra <jaqra@hotmail.com> Co-authored-by: Kyle Evans <kevans91@users.noreply.github.com> Co-authored-by: Tsakiridis Ilias <TsakiDev@users.noreply.github.com> Co-authored-by: Ilias Tsakiridis <ilias.tsakiridis@outlook.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'models/issue_comment.go')
-rw-r--r--models/issue_comment.go38
1 files changed, 38 insertions, 0 deletions
diff --git a/models/issue_comment.go b/models/issue_comment.go
index 94fca493e0..726ed7472b 100644
--- a/models/issue_comment.go
+++ b/models/issue_comment.go
@@ -97,6 +97,10 @@ const (
CommentTypeMergePull
// push to PR head branch
CommentTypePullPush
+ // Project changed
+ CommentTypeProject
+ // Project board changed
+ CommentTypeProjectBoard
)
// CommentTag defines comment tag type
@@ -122,6 +126,10 @@ type Comment struct {
Issue *Issue `xorm:"-"`
LabelID int64
Label *Label `xorm:"-"`
+ OldProjectID int64
+ ProjectID int64
+ OldProject *Project `xorm:"-"`
+ Project *Project `xorm:"-"`
OldMilestoneID int64
MilestoneID int64
OldMilestone *Milestone `xorm:"-"`
@@ -389,6 +397,32 @@ func (c *Comment) LoadLabel() error {
return nil
}
+// LoadProject if comment.Type is CommentTypeProject, then load project.
+func (c *Comment) LoadProject() error {
+
+ if c.OldProjectID > 0 {
+ var oldProject Project
+ has, err := x.ID(c.OldProjectID).Get(&oldProject)
+ if err != nil {
+ return err
+ } else if has {
+ c.OldProject = &oldProject
+ }
+ }
+
+ if c.ProjectID > 0 {
+ var project Project
+ has, err := x.ID(c.ProjectID).Get(&project)
+ if err != nil {
+ return err
+ } else if has {
+ c.Project = &project
+ }
+ }
+
+ return nil
+}
+
// LoadMilestone if comment.Type is CommentTypeMilestone, then load milestone
func (c *Comment) LoadMilestone() error {
if c.OldMilestoneID > 0 {
@@ -647,6 +681,8 @@ func createComment(e *xorm.Session, opts *CreateCommentOptions) (_ *Comment, err
LabelID: LabelID,
OldMilestoneID: opts.OldMilestoneID,
MilestoneID: opts.MilestoneID,
+ OldProjectID: opts.OldProjectID,
+ ProjectID: opts.ProjectID,
RemovedAssignee: opts.RemovedAssignee,
AssigneeID: opts.AssigneeID,
CommitID: opts.CommitID,
@@ -810,6 +846,8 @@ type CreateCommentOptions struct {
DependentIssueID int64
OldMilestoneID int64
MilestoneID int64
+ OldProjectID int64
+ ProjectID int64
AssigneeID int64
RemovedAssignee bool
OldTitle string