diff options
author | Lanre Adelowo <yo@lanre.wtf> | 2020-08-17 04:07:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-16 23:07:38 -0400 |
commit | 4027c5dd7c11c1256094e202be591ec1b86a011e (patch) | |
tree | 49e361a50395f0496c49d52bfd571ee47c1ebf44 /models/issue.go | |
parent | d285b5d35a44bf9fde0682532aeef9550f78cf83 (diff) | |
download | gitea-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.go')
-rw-r--r-- | models/issue.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/models/issue.go b/models/issue.go index 1a4de26b3a..07d7fc9956 100644 --- a/models/issue.go +++ b/models/issue.go @@ -41,6 +41,7 @@ type Issue struct { Labels []*Label `xorm:"-"` MilestoneID int64 `xorm:"INDEX"` Milestone *Milestone `xorm:"-"` + Project *Project `xorm:"-"` Priority int AssigneeID int64 `xorm:"-"` Assignee *User `xorm:"-"` @@ -274,6 +275,10 @@ func (issue *Issue) loadAttributes(e Engine) (err error) { return } + if err = issue.loadProject(e); err != nil { + return + } + if err = issue.loadAssignees(e); err != nil { return } @@ -1062,6 +1067,8 @@ type IssuesOptions struct { PosterID int64 MentionedID int64 MilestoneIDs []int64 + ProjectID int64 + ProjectBoardID int64 IsClosed util.OptionalBool IsPull util.OptionalBool LabelIDs []int64 @@ -1147,6 +1154,19 @@ func (opts *IssuesOptions) setupSession(sess *xorm.Session) { sess.In("issue.milestone_id", opts.MilestoneIDs) } + if opts.ProjectID > 0 { + sess.Join("INNER", "project_issue", "issue.id = project_issue.issue_id"). + And("project_issue.project_id=?", opts.ProjectID) + } + + if opts.ProjectBoardID != 0 { + if opts.ProjectBoardID > 0 { + sess.In("issue.id", builder.Select("issue_id").From("project_issue").Where(builder.Eq{"project_board_id": opts.ProjectBoardID})) + } else { + sess.In("issue.id", builder.Select("issue_id").From("project_issue").Where(builder.Eq{"project_board_id": 0})) + } + } + switch opts.IsPull { case util.OptionalBoolTrue: sess.And("issue.is_pull=?", true) @@ -1953,6 +1973,11 @@ func deleteIssuesByRepoID(sess Engine, repoID int64) (attachmentPaths []string, return } + if _, err = sess.In("issue_id", deleteCond). + Delete(&ProjectIssue{}); err != nil { + return + } + var attachments []*Attachment if err = sess.In("issue_id", deleteCond). Find(&attachments); err != nil { |