From 767a31e0f8ca168434f756ae42a7a896eb4f00f1 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sun, 9 Feb 2020 08:25:31 +0100 Subject: [PATCH] Kanban fix2 (#4) * fix migrations * update settings sample * fix lint * remove merge-conflict relict --- custom/conf/app.ini.sample | 7 +++++-- models/error.go | 1 + models/issue.go | 2 -- models/migrations/migrations.go | 14 +++++++------- models/projects.go | 11 +++++------ routers/repo/issue.go | 2 -- routers/repo/projects.go | 1 + 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/custom/conf/app.ini.sample b/custom/conf/app.ini.sample index 48a5f20c5a981..1f96ce28e995a 100644 --- a/custom/conf/app.ini.sample +++ b/custom/conf/app.ini.sample @@ -51,6 +51,11 @@ DISABLED_REPO_UNITS = DEFAULT_REPO_UNITS = repo.code,repo.releases,repo.issues,repo.pulls,repo.wiki ; Prefix archive files by placing them in a directory named after the repository PREFIX_ARCHIVE_FILES = true +; Enable the kanban board feature system wide. +ENABLE_KANBAN_BOARD = true +; Default templates for kanban borards +PROJECT_BOARD_BASIC_KANBAN_TYPE = Todo, In progress, Done +PROJECT_BOARD_BUG_TRIAGE_TYPE = Needs Triage, High priority, Low priority, Closed [repository.editor] ; List of file extensions for which lines should be wrapped in the CodeMirror editor @@ -432,8 +437,6 @@ BOOST_WORKERS = 5 [admin] ; Disallow regular (non-admin) users from creating organizations. DISABLE_REGULAR_ORG_CREATION = false -; Enable the kanban board feature system wide. -ENABLE_KANBAN_BOARD = true ; Default configuration for email notifications for users (user configurable). Options: enabled, onmention, disabled DEFAULT_EMAIL_NOTIFICATIONS = enabled diff --git a/models/error.go b/models/error.go index ce27fc342dbb1..6e51be15a85f1 100644 --- a/models/error.go +++ b/models/error.go @@ -1525,6 +1525,7 @@ func (err ErrProjectNotExist) Error() string { return fmt.Sprintf("projects does not exist [id: %d, repo_id: %d]", err.ID, err.RepoID) } +// ErrProjectBoardNotExist represents a "ProjectBoardNotExist" kind of error. type ErrProjectBoardNotExist struct { BoardID int64 RepoID int64 diff --git a/models/issue.go b/models/issue.go index 4fe3f5ad7ee78..c473664df2f32 100644 --- a/models/issue.go +++ b/models/issue.go @@ -1121,8 +1121,6 @@ type IssuesOptions struct { MentionedID int64 MilestoneID int64 ProjectID int64 - Page int - PageSize int IsClosed util.OptionalBool IsPull util.OptionalBool LabelIDs []int64 diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go index 910067612c161..8ea81ad354f9c 100644 --- a/models/migrations/migrations.go +++ b/models/migrations/migrations.go @@ -174,19 +174,19 @@ var migrations = []Migration{ NewMigration("Fix migrated repositories' git service type", fixMigratedRepositoryServiceType), // v120 -> v121 NewMigration("Add owner_name on table repository", addOwnerNameOnRepository), - // v120 -> v121 - NewMigration("add is_restricted column for users table", addIsRestricted), // v121 -> v122 - NewMigration("Add Require Signed Commits to ProtectedBranch", addRequireSignedCommits), + NewMigration("add is_restricted column for users table", addIsRestricted), // v122 -> v123 - NewMigration("Add original informations for reactions", addReactionOriginals), + NewMigration("Add Require Signed Commits to ProtectedBranch", addRequireSignedCommits), // v123 -> v124 - NewMigration("Add columns to user and repository", addUserRepoMissingColumns), + NewMigration("Add original informations for reactions", addReactionOriginals), // v124 -> v125 - NewMigration("Add some columns on review for migration", addReviewMigrateInfo), + NewMigration("Add columns to user and repository", addUserRepoMissingColumns), // v125 -> v126 - NewMigration("Fix topic repository count", fixTopicRepositoryCount), + NewMigration("Add some columns on review for migration", addReviewMigrateInfo), // v126 -> v127 + NewMigration("Fix topic repository count", fixTopicRepositoryCount), + // v127 -> v128 NewMigration("add projects info to repository table", addProjectsInfo), } diff --git a/models/projects.go b/models/projects.go index ab27d93b1c321..4fb355b9cf00c 100644 --- a/models/projects.go +++ b/models/projects.go @@ -120,12 +120,12 @@ type Project struct { ClosedDateUnix timeutil.TimeStamp } -// AfterLoad is invoked from XORM after setting the value of a field of -// this object. +// AfterLoad is invoked from XORM after setting the value of a field of this object. func (p *Project) AfterLoad() { p.NumOpenIssues = p.NumIssues - p.NumClosedIssues } +// ProjectSearchOptions are options for GetProjects type ProjectSearchOptions struct { RepoID int64 Page int @@ -134,8 +134,7 @@ type ProjectSearchOptions struct { Type ProjectType } -// GetProjects returns a list of all projects that have been created in the -// repository +// GetProjects returns a list of all projects that have been created in the repository func GetProjects(opts ProjectSearchOptions) ([]*Project, error) { projects := make([]*Project, 0, setting.UI.IssuePagingNum) @@ -286,7 +285,7 @@ func countRepoClosedProjects(e Engine, repoID int64) (int64, error) { Count(new(Project)) } -// ChangeProjectStatus togggles a project between opened and closed +// ChangeProjectStatus toggle a project between opened and closed func ChangeProjectStatus(p *Project, isClosed bool) error { repo, err := GetRepositoryByID(p.RepoID) @@ -443,7 +442,7 @@ func changeProjectAssign(sess *xorm.Session, doer *User, issue *Issue, oldProjec return updateIssueCols(sess, issue, "project_id") } -// MoveIsssueAcrossProjectBoards move a card from one board to another +// MoveIssueAcrossProjectBoards move a card from one board to another func MoveIssueAcrossProjectBoards(issue *Issue, board *ProjectBoard) error { sess := x.NewSession() diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 50544de342bb7..83d553890da05 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -205,8 +205,6 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti MentionedID: mentionedID, MilestoneID: milestoneID, ProjectID: projectID, - Page: pager.Paginater.Current(), - PageSize: setting.UI.IssuePagingNum, IsClosed: util.OptionalBoolOf(isShowClosed), IsPull: isPullOption, LabelIDs: labelIDs, diff --git a/routers/repo/projects.go b/routers/repo/projects.go index f3ea72b773e5f..f379b45abe99a 100644 --- a/routers/repo/projects.go +++ b/routers/repo/projects.go @@ -26,6 +26,7 @@ const ( projectTemplateKey = "ProjectTemplate" ) +// MustEnableProjects check if projects are enabled in settings func MustEnableProjects(ctx *context.Context) { if !setting.Repository.EnableKanbanBoard {