aboutsummaryrefslogtreecommitdiffstats
path: root/models/issues
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2024-05-27 16:59:54 +0800
committerGitHub <noreply@github.com>2024-05-27 08:59:54 +0000
commit98751108b11dc748cc99230ca0fc1acfdf2c8929 (patch)
tree7587c21fe0f038560c5a427eaa1f6614ced604ff /models/issues
parent072b029b336a3d12c40060e8472373fded676dc2 (diff)
downloadgitea-98751108b11dc748cc99230ca0fc1acfdf2c8929.tar.gz
gitea-98751108b11dc748cc99230ca0fc1acfdf2c8929.zip
Rename project board -> column to make the UI less confusing (#30170)
This PR split the `Board` into two parts. One is the struct has been renamed to `Column` and the second we have a `Template Type`. But to make it easier to review, this PR will not change the database schemas, they are just renames. The database schema changes could be in future PRs. --------- Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: yp05327 <576951401@qq.com>
Diffstat (limited to 'models/issues')
-rw-r--r--models/issues/comment.go6
-rw-r--r--models/issues/issue_project.go38
-rw-r--r--models/issues/issue_search.go14
3 files changed, 29 insertions, 29 deletions
diff --git a/models/issues/comment.go b/models/issues/comment.go
index 353163ebd6..336bdde58e 100644
--- a/models/issues/comment.go
+++ b/models/issues/comment.go
@@ -100,8 +100,8 @@ const (
CommentTypeMergePull // 28 merge pull request
CommentTypePullRequestPush // 29 push to PR head branch
- CommentTypeProject // 30 Project changed
- CommentTypeProjectBoard // 31 Project board changed
+ CommentTypeProject // 30 Project changed
+ CommentTypeProjectColumn // 31 Project column changed
CommentTypeDismissReview // 32 Dismiss Review
@@ -146,7 +146,7 @@ var commentStrings = []string{
"merge_pull",
"pull_push",
"project",
- "project_board",
+ "project_board", // FIXME: the name should be project_column
"dismiss_review",
"change_issue_ref",
"pull_scheduled_merge",
diff --git a/models/issues/issue_project.go b/models/issues/issue_project.go
index e31d2ef151..835ea1db52 100644
--- a/models/issues/issue_project.go
+++ b/models/issues/issue_project.go
@@ -37,22 +37,22 @@ func (issue *Issue) projectID(ctx context.Context) int64 {
return ip.ProjectID
}
-// ProjectBoardID return project board id if issue was assigned to one
-func (issue *Issue) ProjectBoardID(ctx context.Context) int64 {
+// ProjectColumnID return project column id if issue was assigned to one
+func (issue *Issue) ProjectColumnID(ctx context.Context) int64 {
var ip project_model.ProjectIssue
has, err := db.GetEngine(ctx).Where("issue_id=?", issue.ID).Get(&ip)
if err != nil || !has {
return 0
}
- return ip.ProjectBoardID
+ return ip.ProjectColumnID
}
-// LoadIssuesFromBoard load issues assigned to this board
-func LoadIssuesFromBoard(ctx context.Context, b *project_model.Board) (IssueList, error) {
+// LoadIssuesFromColumn load issues assigned to this column
+func LoadIssuesFromColumn(ctx context.Context, b *project_model.Column) (IssueList, error) {
issueList, err := Issues(ctx, &IssuesOptions{
- ProjectBoardID: b.ID,
- ProjectID: b.ProjectID,
- SortType: "project-column-sorting",
+ ProjectColumnID: b.ID,
+ ProjectID: b.ProjectID,
+ SortType: "project-column-sorting",
})
if err != nil {
return nil, err
@@ -60,9 +60,9 @@ func LoadIssuesFromBoard(ctx context.Context, b *project_model.Board) (IssueList
if b.Default {
issues, err := Issues(ctx, &IssuesOptions{
- ProjectBoardID: db.NoConditionID,
- ProjectID: b.ProjectID,
- SortType: "project-column-sorting",
+ ProjectColumnID: db.NoConditionID,
+ ProjectID: b.ProjectID,
+ SortType: "project-column-sorting",
})
if err != nil {
return nil, err
@@ -77,11 +77,11 @@ func LoadIssuesFromBoard(ctx context.Context, b *project_model.Board) (IssueList
return issueList, nil
}
-// LoadIssuesFromBoardList load issues assigned to the boards
-func LoadIssuesFromBoardList(ctx context.Context, bs project_model.BoardList) (map[int64]IssueList, error) {
+// LoadIssuesFromColumnList load issues assigned to the columns
+func LoadIssuesFromColumnList(ctx context.Context, bs project_model.ColumnList) (map[int64]IssueList, error) {
issuesMap := make(map[int64]IssueList, len(bs))
for i := range bs {
- il, err := LoadIssuesFromBoard(ctx, bs[i])
+ il, err := LoadIssuesFromColumn(ctx, bs[i])
if err != nil {
return nil, err
}
@@ -110,7 +110,7 @@ func IssueAssignOrRemoveProject(ctx context.Context, issue *Issue, doer *user_mo
return util.NewPermissionDeniedErrorf("issue %d can't be accessed by project %d", issue.ID, newProject.ID)
}
if newColumnID == 0 {
- newDefaultColumn, err := newProject.GetDefaultBoard(ctx)
+ newDefaultColumn, err := newProject.GetDefaultColumn(ctx)
if err != nil {
return err
}
@@ -153,10 +153,10 @@ func IssueAssignOrRemoveProject(ctx context.Context, issue *Issue, doer *user_mo
}
newSorting := util.Iif(res.IssueCount > 0, res.MaxSorting+1, 0)
return db.Insert(ctx, &project_model.ProjectIssue{
- IssueID: issue.ID,
- ProjectID: newProjectID,
- ProjectBoardID: newColumnID,
- Sorting: newSorting,
+ IssueID: issue.ID,
+ ProjectID: newProjectID,
+ ProjectColumnID: newColumnID,
+ Sorting: newSorting,
})
})
}
diff --git a/models/issues/issue_search.go b/models/issues/issue_search.go
index 921dd9973e..491def1229 100644
--- a/models/issues/issue_search.go
+++ b/models/issues/issue_search.go
@@ -33,7 +33,7 @@ type IssuesOptions struct { //nolint
SubscriberID int64
MilestoneIDs []int64
ProjectID int64
- ProjectBoardID int64
+ ProjectColumnID int64
IsClosed optional.Option[bool]
IsPull optional.Option[bool]
LabelIDs []int64
@@ -169,12 +169,12 @@ func applyProjectCondition(sess *xorm.Session, opts *IssuesOptions) *xorm.Sessio
return sess
}
-func applyProjectBoardCondition(sess *xorm.Session, opts *IssuesOptions) *xorm.Session {
- // opts.ProjectBoardID == 0 means all project boards,
+func applyProjectColumnCondition(sess *xorm.Session, opts *IssuesOptions) *xorm.Session {
+ // opts.ProjectColumnID == 0 means all project columns,
// do not need to apply any condition
- if opts.ProjectBoardID > 0 {
- sess.In("issue.id", builder.Select("issue_id").From("project_issue").Where(builder.Eq{"project_board_id": opts.ProjectBoardID}))
- } else if opts.ProjectBoardID == db.NoConditionID {
+ if opts.ProjectColumnID > 0 {
+ sess.In("issue.id", builder.Select("issue_id").From("project_issue").Where(builder.Eq{"project_board_id": opts.ProjectColumnID}))
+ } else if opts.ProjectColumnID == db.NoConditionID {
sess.In("issue.id", builder.Select("issue_id").From("project_issue").Where(builder.Eq{"project_board_id": 0}))
}
return sess
@@ -246,7 +246,7 @@ func applyConditions(sess *xorm.Session, opts *IssuesOptions) *xorm.Session {
applyProjectCondition(sess, opts)
- applyProjectBoardCondition(sess, opts)
+ applyProjectColumnCondition(sess, opts)
if opts.IsPull.Has() {
sess.And("issue.is_pull=?", opts.IsPull.Value())