mirror of
https://github.com/go-gitea/gitea
synced 2025-07-16 07:18:37 +00:00
rename more board -> column
This commit is contained in:
@@ -100,8 +100,8 @@ const (
|
|||||||
CommentTypeMergePull // 28 merge pull request
|
CommentTypeMergePull // 28 merge pull request
|
||||||
CommentTypePullRequestPush // 29 push to PR head branch
|
CommentTypePullRequestPush // 29 push to PR head branch
|
||||||
|
|
||||||
CommentTypeProject // 30 Project changed
|
CommentTypeProject // 30 Project changed
|
||||||
CommentTypeProjectBoard // 31 Project board changed
|
CommentTypeProjectColumn // 31 Project column changed
|
||||||
|
|
||||||
CommentTypeDismissReview // 32 Dismiss Review
|
CommentTypeDismissReview // 32 Dismiss Review
|
||||||
|
|
||||||
|
@@ -47,7 +47,7 @@ func (issue *Issue) ProjectColumnID(ctx context.Context) int64 {
|
|||||||
return ip.ProjectColumnID
|
return ip.ProjectColumnID
|
||||||
}
|
}
|
||||||
|
|
||||||
// LoadIssuesFromColumn load issues assigned to this board
|
// LoadIssuesFromColumn load issues assigned to this column
|
||||||
func LoadIssuesFromColumn(ctx context.Context, b *project_model.Column) (IssueList, error) {
|
func LoadIssuesFromColumn(ctx context.Context, b *project_model.Column) (IssueList, error) {
|
||||||
issueList, err := Issues(ctx, &IssuesOptions{
|
issueList, err := Issues(ctx, &IssuesOptions{
|
||||||
ProjectColumnID: b.ID,
|
ProjectColumnID: b.ID,
|
||||||
@@ -77,7 +77,7 @@ func LoadIssuesFromColumn(ctx context.Context, b *project_model.Column) (IssueLi
|
|||||||
return issueList, nil
|
return issueList, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// LoadIssuesFromColumnList load issues assigned to the boards
|
// LoadIssuesFromColumnList load issues assigned to the columns
|
||||||
func LoadIssuesFromColumnList(ctx context.Context, bs project_model.ColumnList) (map[int64]IssueList, error) {
|
func LoadIssuesFromColumnList(ctx context.Context, bs project_model.ColumnList) (map[int64]IssueList, error) {
|
||||||
issuesMap := make(map[int64]IssueList, len(bs))
|
issuesMap := make(map[int64]IssueList, len(bs))
|
||||||
for i := range bs {
|
for i := range bs {
|
||||||
|
@@ -15,13 +15,13 @@ type (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// BoardViewTypeNone is a project board type that has no predefined columns
|
// BoardViewTypeNone is a project board view type that has no predefined columns
|
||||||
BoardViewTypeNone BoardViewType = iota
|
BoardViewTypeNone BoardViewType = iota
|
||||||
|
|
||||||
// BoardViewTypeBasicKanban is a project board type that has basic predefined columns
|
// BoardViewTypeBasicKanban is a project board view type that has basic predefined columns
|
||||||
BoardViewTypeBasicKanban
|
BoardViewTypeBasicKanban
|
||||||
|
|
||||||
// BoardViewTypeBugTriage is a project board type that has predefined columns suited to hunting down bugs
|
// BoardViewTypeBugTriage is a project board view type that has predefined columns suited to hunting down bugs
|
||||||
BoardViewTypeBugTriage
|
BoardViewTypeBugTriage
|
||||||
)
|
)
|
||||||
|
|
@@ -137,7 +137,7 @@ func NewColumn(ctx context.Context, column *Column) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteColumnByID removes all issues references to the project board.
|
// DeleteColumnByID removes all issues references to the project column.
|
||||||
func DeleteColumnByID(ctx context.Context, columnID int64) error {
|
func DeleteColumnByID(ctx context.Context, columnID int64) error {
|
||||||
return db.WithTx(ctx, func(ctx context.Context) error {
|
return db.WithTx(ctx, func(ctx context.Context) error {
|
||||||
return deleteColumnByID(ctx, columnID)
|
return deleteColumnByID(ctx, columnID)
|
||||||
@@ -155,7 +155,7 @@ func deleteColumnByID(ctx context.Context, columnID int64) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if column.Default {
|
if column.Default {
|
||||||
return fmt.Errorf("deleteBoardByID: cannot delete default board")
|
return fmt.Errorf("deleteBoardByID: cannot delete default column")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = column.removeIssues(ctx); err != nil {
|
if err = column.removeIssues(ctx); err != nil {
|
||||||
@@ -173,17 +173,17 @@ func deleteColumnByProjectID(ctx context.Context, projectID int64) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetColumn fetches the current board of a project
|
// GetColumn fetches the current column of a project
|
||||||
func GetColumn(ctx context.Context, columnID int64) (*Column, error) {
|
func GetColumn(ctx context.Context, columnID int64) (*Column, error) {
|
||||||
board := new(Column)
|
column := new(Column)
|
||||||
has, err := db.GetEngine(ctx).ID(columnID).Get(board)
|
has, err := db.GetEngine(ctx).ID(columnID).Get(column)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else if !has {
|
} else if !has {
|
||||||
return nil, ErrProjectColumnNotExist{ColumnID: columnID}
|
return nil, ErrProjectColumnNotExist{ColumnID: columnID}
|
||||||
}
|
}
|
||||||
|
|
||||||
return board, nil
|
return column, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateColumn updates a project column
|
// UpdateColumn updates a project column
|
||||||
|
@@ -76,7 +76,7 @@ func (p *Project) NumOpenIssues(ctx context.Context) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MoveIssuesOnProjectColumn moves or keeps issues in a column and sorts them inside that column
|
// MoveIssuesOnProjectColumn moves or keeps issues in a column and sorts them inside that column
|
||||||
func MoveIssuesOnProjectColumn(ctx context.Context, board *Column, sortedIssueIDs map[int64]int64) error {
|
func MoveIssuesOnProjectColumn(ctx context.Context, column *Column, sortedIssueIDs map[int64]int64) error {
|
||||||
return db.WithTx(ctx, func(ctx context.Context) error {
|
return db.WithTx(ctx, func(ctx context.Context) error {
|
||||||
sess := db.GetEngine(ctx)
|
sess := db.GetEngine(ctx)
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ func MoveIssuesOnProjectColumn(ctx context.Context, board *Column, sortedIssueID
|
|||||||
for _, issueID := range sortedIssueIDs {
|
for _, issueID := range sortedIssueIDs {
|
||||||
issueIDs = append(issueIDs, issueID)
|
issueIDs = append(issueIDs, issueID)
|
||||||
}
|
}
|
||||||
count, err := sess.Table(new(ProjectIssue)).Where("project_id=?", board.ProjectID).In("issue_id", issueIDs).Count()
|
count, err := sess.Table(new(ProjectIssue)).Where("project_id=?", column.ProjectID).In("issue_id", issueIDs).Count()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -93,7 +93,7 @@ func MoveIssuesOnProjectColumn(ctx context.Context, board *Column, sortedIssueID
|
|||||||
}
|
}
|
||||||
|
|
||||||
for sorting, issueID := range sortedIssueIDs {
|
for sorting, issueID := range sortedIssueIDs {
|
||||||
_, err = sess.Exec("UPDATE `project_issue` SET project_board_id=?, sorting=? WHERE issue_id=?", board.ID, sorting, issueID)
|
_, err = sess.Exec("UPDATE `project_issue` SET project_board_id=?, sorting=? WHERE issue_id=?", column.ID, sorting, issueID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@@ -21,7 +21,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
// CardConfig is used to identify the type of board card that is being used
|
// CardConfig is used to identify the type of column card that is being used
|
||||||
CardConfig struct {
|
CardConfig struct {
|
||||||
CardType CardType
|
CardType CardType
|
||||||
Translation string
|
Translation string
|
||||||
@@ -32,7 +32,7 @@ type (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// TypeIndividual is a type of project board that is owned by an individual
|
// TypeIndividual is a type of project column that is owned by an individual
|
||||||
TypeIndividual Type = iota + 1
|
TypeIndividual Type = iota + 1
|
||||||
|
|
||||||
// TypeRepository is a project that is tied to a repository
|
// TypeRepository is a project that is tied to a repository
|
||||||
@@ -62,12 +62,12 @@ func (err ErrProjectNotExist) Unwrap() error {
|
|||||||
return util.ErrNotExist
|
return util.ErrNotExist
|
||||||
}
|
}
|
||||||
|
|
||||||
// ErrProjectColumnNotExist represents a "ProjectBoardNotExist" kind of error.
|
// ErrProjectColumnNotExist represents a "ErrProjectColumnNotExist" kind of error.
|
||||||
type ErrProjectColumnNotExist struct {
|
type ErrProjectColumnNotExist struct {
|
||||||
ColumnID int64
|
ColumnID int64
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsErrProjectColumnNotExist checks if an error is a ErrProjectBoardNotExist
|
// IsErrProjectColumnNotExist checks if an error is a ErrProjectColumnNotExist
|
||||||
func IsErrProjectColumnNotExist(err error) bool {
|
func IsErrProjectColumnNotExist(err error) bool {
|
||||||
_, ok := err.(ErrProjectColumnNotExist)
|
_, ok := err.(ErrProjectColumnNotExist)
|
||||||
return ok
|
return ok
|
||||||
@@ -81,7 +81,7 @@ func (err ErrProjectColumnNotExist) Unwrap() error {
|
|||||||
return util.ErrNotExist
|
return util.ErrNotExist
|
||||||
}
|
}
|
||||||
|
|
||||||
// Project represents a project board
|
// Project represents a project
|
||||||
type Project struct {
|
type Project struct {
|
||||||
ID int64 `xorm:"pk autoincr"`
|
ID int64 `xorm:"pk autoincr"`
|
||||||
Title string `xorm:"INDEX NOT NULL"`
|
Title string `xorm:"INDEX NOT NULL"`
|
||||||
@@ -159,7 +159,7 @@ func init() {
|
|||||||
db.RegisterModel(new(Project))
|
db.RegisterModel(new(Project))
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetCardConfig retrieves the types of configurations project board cards could have
|
// GetCardConfig retrieves the types of configurations project column cards could have
|
||||||
func GetCardConfig() []CardConfig {
|
func GetCardConfig() []CardConfig {
|
||||||
return []CardConfig{
|
return []CardConfig{
|
||||||
{CardTypeTextOnly, "repo.projects.card_type.text_only"},
|
{CardTypeTextOnly, "repo.projects.card_type.text_only"},
|
||||||
|
@@ -27,7 +27,7 @@ const (
|
|||||||
TypeWiki // 5 Wiki
|
TypeWiki // 5 Wiki
|
||||||
TypeExternalWiki // 6 ExternalWiki
|
TypeExternalWiki // 6 ExternalWiki
|
||||||
TypeExternalTracker // 7 ExternalTracker
|
TypeExternalTracker // 7 ExternalTracker
|
||||||
TypeProjects // 8 Kanban board
|
TypeProjects // 8 Projects
|
||||||
TypePackages // 9 Packages
|
TypePackages // 9 Packages
|
||||||
TypeActions // 10 Actions
|
TypeActions // 10 Actions
|
||||||
)
|
)
|
||||||
|
@@ -375,7 +375,7 @@ func searchIssueInProject(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
SearchOptions{
|
SearchOptions{
|
||||||
ProjectColumnID: optional.Some(int64(0)), // issue with in default board
|
ProjectColumnID: optional.Some(int64(0)), // issue with in default column
|
||||||
},
|
},
|
||||||
[]int64{2},
|
[]int64{2},
|
||||||
},
|
},
|
||||||
|
@@ -27,7 +27,7 @@ type IndexerData struct {
|
|||||||
NoLabel bool `json:"no_label"` // True if LabelIDs is empty
|
NoLabel bool `json:"no_label"` // True if LabelIDs is empty
|
||||||
MilestoneID int64 `json:"milestone_id"`
|
MilestoneID int64 `json:"milestone_id"`
|
||||||
ProjectID int64 `json:"project_id"`
|
ProjectID int64 `json:"project_id"`
|
||||||
ProjectBoardID int64 `json:"project_board_id"`
|
ProjectColumnID int64 `json:"project_board_id"` // the key should be kept as project_board_id to keep compatible
|
||||||
PosterID int64 `json:"poster_id"`
|
PosterID int64 `json:"poster_id"`
|
||||||
AssigneeID int64 `json:"assignee_id"`
|
AssigneeID int64 `json:"assignee_id"`
|
||||||
MentionIDs []int64 `json:"mention_ids"`
|
MentionIDs []int64 `json:"mention_ids"`
|
||||||
|
@@ -338,7 +338,7 @@ var cases = []*testIndexerCase{
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "ProjectBoardID",
|
Name: "ProjectColumnID",
|
||||||
SearchOptions: &internal.SearchOptions{
|
SearchOptions: &internal.SearchOptions{
|
||||||
Paginator: &db.ListOptions{
|
Paginator: &db.ListOptions{
|
||||||
PageSize: 5,
|
PageSize: 5,
|
||||||
@@ -348,15 +348,15 @@ var cases = []*testIndexerCase{
|
|||||||
Expected: func(t *testing.T, data map[int64]*internal.IndexerData, result *internal.SearchResult) {
|
Expected: func(t *testing.T, data map[int64]*internal.IndexerData, result *internal.SearchResult) {
|
||||||
assert.Equal(t, 5, len(result.Hits))
|
assert.Equal(t, 5, len(result.Hits))
|
||||||
for _, v := range result.Hits {
|
for _, v := range result.Hits {
|
||||||
assert.Equal(t, int64(1), data[v.ID].ProjectBoardID)
|
assert.Equal(t, int64(1), data[v.ID].ProjectColumnID)
|
||||||
}
|
}
|
||||||
assert.Equal(t, countIndexerData(data, func(v *internal.IndexerData) bool {
|
assert.Equal(t, countIndexerData(data, func(v *internal.IndexerData) bool {
|
||||||
return v.ProjectBoardID == 1
|
return v.ProjectColumnID == 1
|
||||||
}), result.Total)
|
}), result.Total)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "no ProjectBoardID",
|
Name: "no ProjectColumnID",
|
||||||
SearchOptions: &internal.SearchOptions{
|
SearchOptions: &internal.SearchOptions{
|
||||||
Paginator: &db.ListOptions{
|
Paginator: &db.ListOptions{
|
||||||
PageSize: 5,
|
PageSize: 5,
|
||||||
@@ -366,10 +366,10 @@ var cases = []*testIndexerCase{
|
|||||||
Expected: func(t *testing.T, data map[int64]*internal.IndexerData, result *internal.SearchResult) {
|
Expected: func(t *testing.T, data map[int64]*internal.IndexerData, result *internal.SearchResult) {
|
||||||
assert.Equal(t, 5, len(result.Hits))
|
assert.Equal(t, 5, len(result.Hits))
|
||||||
for _, v := range result.Hits {
|
for _, v := range result.Hits {
|
||||||
assert.Equal(t, int64(0), data[v.ID].ProjectBoardID)
|
assert.Equal(t, int64(0), data[v.ID].ProjectColumnID)
|
||||||
}
|
}
|
||||||
assert.Equal(t, countIndexerData(data, func(v *internal.IndexerData) bool {
|
assert.Equal(t, countIndexerData(data, func(v *internal.IndexerData) bool {
|
||||||
return v.ProjectBoardID == 0
|
return v.ProjectColumnID == 0
|
||||||
}), result.Total)
|
}), result.Total)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -706,7 +706,7 @@ func generateDefaultIndexerData() []*internal.IndexerData {
|
|||||||
NoLabel: len(labelIDs) == 0,
|
NoLabel: len(labelIDs) == 0,
|
||||||
MilestoneID: issueIndex % 4,
|
MilestoneID: issueIndex % 4,
|
||||||
ProjectID: issueIndex % 5,
|
ProjectID: issueIndex % 5,
|
||||||
ProjectBoardID: issueIndex % 6,
|
ProjectColumnID: issueIndex % 6,
|
||||||
PosterID: id%10 + 1, // PosterID should not be 0
|
PosterID: id%10 + 1, // PosterID should not be 0
|
||||||
AssigneeID: issueIndex % 10,
|
AssigneeID: issueIndex % 10,
|
||||||
MentionIDs: mentionIDs,
|
MentionIDs: mentionIDs,
|
||||||
|
@@ -105,7 +105,7 @@ func getIssueIndexerData(ctx context.Context, issueID int64) (*internal.IndexerD
|
|||||||
NoLabel: len(labels) == 0,
|
NoLabel: len(labels) == 0,
|
||||||
MilestoneID: issue.MilestoneID,
|
MilestoneID: issue.MilestoneID,
|
||||||
ProjectID: projectID,
|
ProjectID: projectID,
|
||||||
ProjectBoardID: issue.ProjectColumnID(ctx),
|
ProjectColumnID: issue.ProjectColumnID(ctx),
|
||||||
PosterID: issue.PosterID,
|
PosterID: issue.PosterID,
|
||||||
AssigneeID: issue.AssigneeID,
|
AssigneeID: issue.AssigneeID,
|
||||||
MentionIDs: mentionIDs,
|
MentionIDs: mentionIDs,
|
||||||
|
@@ -36,7 +36,7 @@ type Collector struct {
|
|||||||
Oauths *prometheus.Desc
|
Oauths *prometheus.Desc
|
||||||
Organizations *prometheus.Desc
|
Organizations *prometheus.Desc
|
||||||
Projects *prometheus.Desc
|
Projects *prometheus.Desc
|
||||||
ProjectBoards *prometheus.Desc
|
ProjectColumns *prometheus.Desc
|
||||||
PublicKeys *prometheus.Desc
|
PublicKeys *prometheus.Desc
|
||||||
Releases *prometheus.Desc
|
Releases *prometheus.Desc
|
||||||
Repositories *prometheus.Desc
|
Repositories *prometheus.Desc
|
||||||
@@ -146,7 +146,7 @@ func NewCollector() Collector {
|
|||||||
"Number of projects",
|
"Number of projects",
|
||||||
nil, nil,
|
nil, nil,
|
||||||
),
|
),
|
||||||
ProjectBoards: prometheus.NewDesc(
|
ProjectColumns: prometheus.NewDesc(
|
||||||
namespace+"projects_boards",
|
namespace+"projects_boards",
|
||||||
"Number of project boards",
|
"Number of project boards",
|
||||||
nil, nil,
|
nil, nil,
|
||||||
@@ -219,7 +219,7 @@ func (c Collector) Describe(ch chan<- *prometheus.Desc) {
|
|||||||
ch <- c.Oauths
|
ch <- c.Oauths
|
||||||
ch <- c.Organizations
|
ch <- c.Organizations
|
||||||
ch <- c.Projects
|
ch <- c.Projects
|
||||||
ch <- c.ProjectBoards
|
ch <- c.ProjectColumns
|
||||||
ch <- c.PublicKeys
|
ch <- c.PublicKeys
|
||||||
ch <- c.Releases
|
ch <- c.Releases
|
||||||
ch <- c.Repositories
|
ch <- c.Repositories
|
||||||
@@ -336,7 +336,7 @@ func (c Collector) Collect(ch chan<- prometheus.Metric) {
|
|||||||
float64(stats.Counter.Project),
|
float64(stats.Counter.Project),
|
||||||
)
|
)
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.ProjectBoards,
|
c.ProjectColumns,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
float64(stats.Counter.ProjectColumn),
|
float64(stats.Counter.ProjectColumn),
|
||||||
)
|
)
|
||||||
|
@@ -315,7 +315,7 @@ func EditProjectPost(ctx *context.Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ViewProject renders the project board for a project
|
// ViewProject renders the project with board view for a project
|
||||||
func ViewProject(ctx *context.Context) {
|
func ViewProject(ctx *context.Context) {
|
||||||
project, err := project_model.GetProjectByID(ctx, ctx.ParamsInt64(":id"))
|
project, err := project_model.GetProjectByID(ctx, ctx.ParamsInt64(":id"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -329,7 +329,7 @@ func ViewProject(ctx *context.Context) {
|
|||||||
|
|
||||||
boards, err := project.GetColumns(ctx)
|
boards, err := project.GetColumns(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.ServerError("GetProjectBoards", err)
|
ctx.ServerError("GetProjectColumns", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -458,7 +458,7 @@ func UpdateIssueProject(ctx *context.Context) {
|
|||||||
ctx.JSONOK()
|
ctx.JSONOK()
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteProjectColumn allows for the deletion of a project board
|
// DeleteProjectColumn allows for the deletion of a project column
|
||||||
func DeleteProjectColumn(ctx *context.Context) {
|
func DeleteProjectColumn(ctx *context.Context) {
|
||||||
if ctx.Doer == nil {
|
if ctx.Doer == nil {
|
||||||
ctx.JSON(http.StatusForbidden, map[string]string{
|
ctx.JSON(http.StatusForbidden, map[string]string{
|
||||||
@@ -475,32 +475,32 @@ func DeleteProjectColumn(ctx *context.Context) {
|
|||||||
|
|
||||||
pb, err := project_model.GetColumn(ctx, ctx.ParamsInt64(":boardID"))
|
pb, err := project_model.GetColumn(ctx, ctx.ParamsInt64(":boardID"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.ServerError("GetProjectBoard", err)
|
ctx.ServerError("GetProjectColumn", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if pb.ProjectID != ctx.ParamsInt64(":id") {
|
if pb.ProjectID != ctx.ParamsInt64(":id") {
|
||||||
ctx.JSON(http.StatusUnprocessableEntity, map[string]string{
|
ctx.JSON(http.StatusUnprocessableEntity, map[string]string{
|
||||||
"message": fmt.Sprintf("ProjectBoard[%d] is not in Project[%d] as expected", pb.ID, project.ID),
|
"message": fmt.Sprintf("ProjectColumn[%d] is not in Project[%d] as expected", pb.ID, project.ID),
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if project.OwnerID != ctx.ContextUser.ID {
|
if project.OwnerID != ctx.ContextUser.ID {
|
||||||
ctx.JSON(http.StatusUnprocessableEntity, map[string]string{
|
ctx.JSON(http.StatusUnprocessableEntity, map[string]string{
|
||||||
"message": fmt.Sprintf("ProjectBoard[%d] is not in Owner[%d] as expected", pb.ID, ctx.ContextUser.ID),
|
"message": fmt.Sprintf("ProjectColumn[%d] is not in Owner[%d] as expected", pb.ID, ctx.ContextUser.ID),
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := project_model.DeleteColumnByID(ctx, ctx.ParamsInt64(":boardID")); err != nil {
|
if err := project_model.DeleteColumnByID(ctx, ctx.ParamsInt64(":boardID")); err != nil {
|
||||||
ctx.ServerError("DeleteProjectBoardByID", err)
|
ctx.ServerError("DeleteProjectColumnByID", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.JSONOK()
|
ctx.JSONOK()
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddColumnToProjectPost allows a new board to be added to a project.
|
// AddColumnToProjectPost allows a new column to be added to a project.
|
||||||
func AddColumnToProjectPost(ctx *context.Context) {
|
func AddColumnToProjectPost(ctx *context.Context) {
|
||||||
form := web.GetForm(ctx).(*forms.EditProjectColumnForm)
|
form := web.GetForm(ctx).(*forms.EditProjectColumnForm)
|
||||||
|
|
||||||
@@ -516,15 +516,15 @@ func AddColumnToProjectPost(ctx *context.Context) {
|
|||||||
Color: form.Color,
|
Color: form.Color,
|
||||||
CreatorID: ctx.Doer.ID,
|
CreatorID: ctx.Doer.ID,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
ctx.ServerError("NewProjectBoard", err)
|
ctx.ServerError("NewProjectColumn", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.JSONOK()
|
ctx.JSONOK()
|
||||||
}
|
}
|
||||||
|
|
||||||
// CheckProjectBoardChangePermissions check permission
|
// CheckProjectColumnChangePermissions check permission
|
||||||
func CheckProjectBoardChangePermissions(ctx *context.Context) (*project_model.Project, *project_model.Column) {
|
func CheckProjectColumnChangePermissions(ctx *context.Context) (*project_model.Project, *project_model.Column) {
|
||||||
if ctx.Doer == nil {
|
if ctx.Doer == nil {
|
||||||
ctx.JSON(http.StatusForbidden, map[string]string{
|
ctx.JSON(http.StatusForbidden, map[string]string{
|
||||||
"message": "Only signed in users are allowed to perform this action.",
|
"message": "Only signed in users are allowed to perform this action.",
|
||||||
@@ -538,62 +538,60 @@ func CheckProjectBoardChangePermissions(ctx *context.Context) (*project_model.Pr
|
|||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
board, err := project_model.GetColumn(ctx, ctx.ParamsInt64(":boardID"))
|
column, err := project_model.GetColumn(ctx, ctx.ParamsInt64(":boardID"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.ServerError("GetProjectBoard", err)
|
ctx.ServerError("GetProjectColumn", err)
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
if board.ProjectID != ctx.ParamsInt64(":id") {
|
if column.ProjectID != ctx.ParamsInt64(":id") {
|
||||||
ctx.JSON(http.StatusUnprocessableEntity, map[string]string{
|
ctx.JSON(http.StatusUnprocessableEntity, map[string]string{
|
||||||
"message": fmt.Sprintf("ProjectBoard[%d] is not in Project[%d] as expected", board.ID, project.ID),
|
"message": fmt.Sprintf("ProjectColumn[%d] is not in Project[%d] as expected", column.ID, project.ID),
|
||||||
})
|
})
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if project.OwnerID != ctx.ContextUser.ID {
|
if project.OwnerID != ctx.ContextUser.ID {
|
||||||
ctx.JSON(http.StatusUnprocessableEntity, map[string]string{
|
ctx.JSON(http.StatusUnprocessableEntity, map[string]string{
|
||||||
"message": fmt.Sprintf("ProjectBoard[%d] is not in Repository[%d] as expected", board.ID, project.ID),
|
"message": fmt.Sprintf("ProjectColumn[%d] is not in Repository[%d] as expected", column.ID, project.ID),
|
||||||
})
|
})
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
return project, board
|
return project, column
|
||||||
}
|
}
|
||||||
|
|
||||||
// EditProjectColumn allows a project board's to be updated
|
// EditProjectColumn allows a project column's to be updated
|
||||||
func EditProjectColumn(ctx *context.Context) {
|
func EditProjectColumn(ctx *context.Context) {
|
||||||
form := web.GetForm(ctx).(*forms.EditProjectColumnForm)
|
form := web.GetForm(ctx).(*forms.EditProjectColumnForm)
|
||||||
_, board := CheckProjectBoardChangePermissions(ctx)
|
_, column := CheckProjectColumnChangePermissions(ctx)
|
||||||
if ctx.Written() {
|
if ctx.Written() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if form.Title != "" {
|
if form.Title != "" {
|
||||||
board.Title = form.Title
|
column.Title = form.Title
|
||||||
}
|
}
|
||||||
|
column.Color = form.Color
|
||||||
board.Color = form.Color
|
|
||||||
|
|
||||||
if form.Sorting != 0 {
|
if form.Sorting != 0 {
|
||||||
board.Sorting = form.Sorting
|
column.Sorting = form.Sorting
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := project_model.UpdateColumn(ctx, board); err != nil {
|
if err := project_model.UpdateColumn(ctx, column); err != nil {
|
||||||
ctx.ServerError("UpdateProjectBoard", err)
|
ctx.ServerError("UpdateProjectColumn", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.JSONOK()
|
ctx.JSONOK()
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetDefaultProjectBoard set default board for uncategorized issues/pulls
|
// SetDefaultProjectColumn set default column for uncategorized issues/pulls
|
||||||
func SetDefaultProjectBoard(ctx *context.Context) {
|
func SetDefaultProjectColumn(ctx *context.Context) {
|
||||||
project, board := CheckProjectBoardChangePermissions(ctx)
|
project, column := CheckProjectColumnChangePermissions(ctx)
|
||||||
if ctx.Written() {
|
if ctx.Written() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := project_model.SetDefaultColumn(ctx, project.ID, board.ID); err != nil {
|
if err := project_model.SetDefaultColumn(ctx, project.ID, column.ID); err != nil {
|
||||||
ctx.ServerError("SetDefaultBoard", err)
|
ctx.ServerError("SetDefaultColumn", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -619,13 +617,13 @@ func MoveIssues(ctx *context.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
board, err := project_model.GetColumn(ctx, ctx.ParamsInt64(":boardID"))
|
column, err := project_model.GetColumn(ctx, ctx.ParamsInt64(":boardID"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.NotFoundOrServerError("GetProjectBoard", project_model.IsErrProjectColumnNotExist, err)
|
ctx.NotFoundOrServerError("GetProjectColumn", project_model.IsErrProjectColumnNotExist, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if board.ProjectID != project.ID {
|
if column.ProjectID != project.ID {
|
||||||
ctx.NotFound("BoardNotInProject", nil)
|
ctx.NotFound("BoardNotInProject", nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -671,8 +669,8 @@ func MoveIssues(ctx *context.Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = project_model.MoveIssuesOnProjectColumn(ctx, board, sortedIssueIDs); err != nil {
|
if err = project_model.MoveIssuesOnProjectColumn(ctx, column, sortedIssueIDs); err != nil {
|
||||||
ctx.ServerError("MoveIssuesOnProjectBoard", err)
|
ctx.ServerError("MoveIssuesOnProjectColumn", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -13,7 +13,7 @@ import (
|
|||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCheckProjectBoardChangePermissions(t *testing.T) {
|
func TestCheckProjectColumnChangePermissions(t *testing.T) {
|
||||||
unittest.PrepareTestEnv(t)
|
unittest.PrepareTestEnv(t)
|
||||||
ctx, _ := contexttest.MockContext(t, "user2/-/projects/4/4")
|
ctx, _ := contexttest.MockContext(t, "user2/-/projects/4/4")
|
||||||
contexttest.LoadUser(t, ctx, 2)
|
contexttest.LoadUser(t, ctx, 2)
|
||||||
@@ -21,8 +21,8 @@ func TestCheckProjectBoardChangePermissions(t *testing.T) {
|
|||||||
ctx.SetParams(":id", "4")
|
ctx.SetParams(":id", "4")
|
||||||
ctx.SetParams(":boardID", "4")
|
ctx.SetParams(":boardID", "4")
|
||||||
|
|
||||||
project, board := org.CheckProjectBoardChangePermissions(ctx)
|
project, column := org.CheckProjectColumnChangePermissions(ctx)
|
||||||
assert.NotNil(t, project)
|
assert.NotNil(t, project)
|
||||||
assert.NotNil(t, board)
|
assert.NotNil(t, column)
|
||||||
assert.False(t, ctx.Written())
|
assert.False(t, ctx.Written())
|
||||||
}
|
}
|
||||||
|
@@ -293,7 +293,7 @@ func EditProjectPost(ctx *context.Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ViewProject renders the project board for a project
|
// ViewProject renders the project with board view
|
||||||
func ViewProject(ctx *context.Context) {
|
func ViewProject(ctx *context.Context) {
|
||||||
project, err := project_model.GetProjectByID(ctx, ctx.ParamsInt64(":id"))
|
project, err := project_model.GetProjectByID(ctx, ctx.ParamsInt64(":id"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -311,7 +311,7 @@ func ViewProject(ctx *context.Context) {
|
|||||||
|
|
||||||
boards, err := project.GetColumns(ctx)
|
boards, err := project.GetColumns(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.ServerError("GetProjectBoards", err)
|
ctx.ServerError("GetProjectColumns", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -406,8 +406,8 @@ func UpdateIssueProject(ctx *context.Context) {
|
|||||||
ctx.JSONOK()
|
ctx.JSONOK()
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteProjectBoard allows for the deletion of a project board
|
// DeleteProjectColumn allows for the deletion of a project column
|
||||||
func DeleteProjectBoard(ctx *context.Context) {
|
func DeleteProjectColumn(ctx *context.Context) {
|
||||||
if ctx.Doer == nil {
|
if ctx.Doer == nil {
|
||||||
ctx.JSON(http.StatusForbidden, map[string]string{
|
ctx.JSON(http.StatusForbidden, map[string]string{
|
||||||
"message": "Only signed in users are allowed to perform this action.",
|
"message": "Only signed in users are allowed to perform this action.",
|
||||||
@@ -434,33 +434,33 @@ func DeleteProjectBoard(ctx *context.Context) {
|
|||||||
|
|
||||||
pb, err := project_model.GetColumn(ctx, ctx.ParamsInt64(":boardID"))
|
pb, err := project_model.GetColumn(ctx, ctx.ParamsInt64(":boardID"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.ServerError("GetProjectBoard", err)
|
ctx.ServerError("GetProjectColumn", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if pb.ProjectID != ctx.ParamsInt64(":id") {
|
if pb.ProjectID != ctx.ParamsInt64(":id") {
|
||||||
ctx.JSON(http.StatusUnprocessableEntity, map[string]string{
|
ctx.JSON(http.StatusUnprocessableEntity, map[string]string{
|
||||||
"message": fmt.Sprintf("ProjectBoard[%d] is not in Project[%d] as expected", pb.ID, project.ID),
|
"message": fmt.Sprintf("ProjectColumn[%d] is not in Project[%d] as expected", pb.ID, project.ID),
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if project.RepoID != ctx.Repo.Repository.ID {
|
if project.RepoID != ctx.Repo.Repository.ID {
|
||||||
ctx.JSON(http.StatusUnprocessableEntity, map[string]string{
|
ctx.JSON(http.StatusUnprocessableEntity, map[string]string{
|
||||||
"message": fmt.Sprintf("ProjectBoard[%d] is not in Repository[%d] as expected", pb.ID, ctx.Repo.Repository.ID),
|
"message": fmt.Sprintf("ProjectColumn[%d] is not in Repository[%d] as expected", pb.ID, ctx.Repo.Repository.ID),
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := project_model.DeleteColumnByID(ctx, ctx.ParamsInt64(":boardID")); err != nil {
|
if err := project_model.DeleteColumnByID(ctx, ctx.ParamsInt64(":boardID")); err != nil {
|
||||||
ctx.ServerError("DeleteProjectBoardByID", err)
|
ctx.ServerError("DeleteProjectColumnByID", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.JSONOK()
|
ctx.JSONOK()
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddBoardToProjectPost allows a new board to be added to a project.
|
// AddColumnToProjectPost allows a new column to be added to a project.
|
||||||
func AddBoardToProjectPost(ctx *context.Context) {
|
func AddColumnToProjectPost(ctx *context.Context) {
|
||||||
form := web.GetForm(ctx).(*forms.EditProjectColumnForm)
|
form := web.GetForm(ctx).(*forms.EditProjectColumnForm)
|
||||||
if !ctx.Repo.IsOwner() && !ctx.Repo.IsAdmin() && !ctx.Repo.CanAccess(perm.AccessModeWrite, unit.TypeProjects) {
|
if !ctx.Repo.IsOwner() && !ctx.Repo.IsAdmin() && !ctx.Repo.CanAccess(perm.AccessModeWrite, unit.TypeProjects) {
|
||||||
ctx.JSON(http.StatusForbidden, map[string]string{
|
ctx.JSON(http.StatusForbidden, map[string]string{
|
||||||
@@ -485,14 +485,14 @@ func AddBoardToProjectPost(ctx *context.Context) {
|
|||||||
Color: form.Color,
|
Color: form.Color,
|
||||||
CreatorID: ctx.Doer.ID,
|
CreatorID: ctx.Doer.ID,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
ctx.ServerError("NewProjectBoard", err)
|
ctx.ServerError("NewProjectColumn", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.JSONOK()
|
ctx.JSONOK()
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkProjectBoardChangePermissions(ctx *context.Context) (*project_model.Project, *project_model.Column) {
|
func checkProjectColumnChangePermissions(ctx *context.Context) (*project_model.Project, *project_model.Column) {
|
||||||
if ctx.Doer == nil {
|
if ctx.Doer == nil {
|
||||||
ctx.JSON(http.StatusForbidden, map[string]string{
|
ctx.JSON(http.StatusForbidden, map[string]string{
|
||||||
"message": "Only signed in users are allowed to perform this action.",
|
"message": "Only signed in users are allowed to perform this action.",
|
||||||
@@ -517,61 +517,59 @@ func checkProjectBoardChangePermissions(ctx *context.Context) (*project_model.Pr
|
|||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
board, err := project_model.GetColumn(ctx, ctx.ParamsInt64(":boardID"))
|
column, err := project_model.GetColumn(ctx, ctx.ParamsInt64(":boardID"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.ServerError("GetProjectBoard", err)
|
ctx.ServerError("GetProjectColumn", err)
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
if board.ProjectID != ctx.ParamsInt64(":id") {
|
if column.ProjectID != ctx.ParamsInt64(":id") {
|
||||||
ctx.JSON(http.StatusUnprocessableEntity, map[string]string{
|
ctx.JSON(http.StatusUnprocessableEntity, map[string]string{
|
||||||
"message": fmt.Sprintf("ProjectBoard[%d] is not in Project[%d] as expected", board.ID, project.ID),
|
"message": fmt.Sprintf("ProjectColumn[%d] is not in Project[%d] as expected", column.ID, project.ID),
|
||||||
})
|
})
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if project.RepoID != ctx.Repo.Repository.ID {
|
if project.RepoID != ctx.Repo.Repository.ID {
|
||||||
ctx.JSON(http.StatusUnprocessableEntity, map[string]string{
|
ctx.JSON(http.StatusUnprocessableEntity, map[string]string{
|
||||||
"message": fmt.Sprintf("ProjectBoard[%d] is not in Repository[%d] as expected", board.ID, ctx.Repo.Repository.ID),
|
"message": fmt.Sprintf("ProjectColumn[%d] is not in Repository[%d] as expected", column.ID, ctx.Repo.Repository.ID),
|
||||||
})
|
})
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
return project, board
|
return project, column
|
||||||
}
|
}
|
||||||
|
|
||||||
// EditProjectColumn allows a project board's to be updated
|
// EditProjectColumn allows a project column's to be updated
|
||||||
func EditProjectColumn(ctx *context.Context) {
|
func EditProjectColumn(ctx *context.Context) {
|
||||||
form := web.GetForm(ctx).(*forms.EditProjectColumnForm)
|
form := web.GetForm(ctx).(*forms.EditProjectColumnForm)
|
||||||
_, board := checkProjectBoardChangePermissions(ctx)
|
_, column := checkProjectColumnChangePermissions(ctx)
|
||||||
if ctx.Written() {
|
if ctx.Written() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if form.Title != "" {
|
if form.Title != "" {
|
||||||
board.Title = form.Title
|
column.Title = form.Title
|
||||||
}
|
}
|
||||||
|
column.Color = form.Color
|
||||||
board.Color = form.Color
|
|
||||||
|
|
||||||
if form.Sorting != 0 {
|
if form.Sorting != 0 {
|
||||||
board.Sorting = form.Sorting
|
column.Sorting = form.Sorting
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := project_model.UpdateColumn(ctx, board); err != nil {
|
if err := project_model.UpdateColumn(ctx, column); err != nil {
|
||||||
ctx.ServerError("UpdateProjectBoard", err)
|
ctx.ServerError("UpdateProjectColumn", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.JSONOK()
|
ctx.JSONOK()
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetDefaultProjectColumn set default board for uncategorized issues/pulls
|
// SetDefaultProjectColumn set default column for uncategorized issues/pulls
|
||||||
func SetDefaultProjectColumn(ctx *context.Context) {
|
func SetDefaultProjectColumn(ctx *context.Context) {
|
||||||
project, board := checkProjectBoardChangePermissions(ctx)
|
project, column := checkProjectColumnChangePermissions(ctx)
|
||||||
if ctx.Written() {
|
if ctx.Written() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := project_model.SetDefaultColumn(ctx, project.ID, board.ID); err != nil {
|
if err := project_model.SetDefaultColumn(ctx, project.ID, column.ID); err != nil {
|
||||||
ctx.ServerError("SetDefaultBoard", err)
|
ctx.ServerError("SetDefaultBoard", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -609,7 +607,7 @@ func MoveIssues(ctx *context.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
board, err := project_model.GetColumn(ctx, ctx.ParamsInt64(":boardID"))
|
column, err := project_model.GetColumn(ctx, ctx.ParamsInt64(":boardID"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if project_model.IsErrProjectColumnNotExist(err) {
|
if project_model.IsErrProjectColumnNotExist(err) {
|
||||||
ctx.NotFound("ProjectColumnNotExist", nil)
|
ctx.NotFound("ProjectColumnNotExist", nil)
|
||||||
@@ -619,7 +617,7 @@ func MoveIssues(ctx *context.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if board.ProjectID != project.ID {
|
if column.ProjectID != project.ID {
|
||||||
ctx.NotFound("BoardNotInProject", nil)
|
ctx.NotFound("BoardNotInProject", nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -664,7 +662,7 @@ func MoveIssues(ctx *context.Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = project_model.MoveIssuesOnProjectColumn(ctx, board, sortedIssueIDs); err != nil {
|
if err = project_model.MoveIssuesOnProjectColumn(ctx, column, sortedIssueIDs); err != nil {
|
||||||
ctx.ServerError("MoveIssuesOnProjectColumn", err)
|
ctx.ServerError("MoveIssuesOnProjectColumn", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@@ -12,7 +12,7 @@ import (
|
|||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCheckProjectBoardChangePermissions(t *testing.T) {
|
func TestCheckProjectColumnChangePermissions(t *testing.T) {
|
||||||
unittest.PrepareTestEnv(t)
|
unittest.PrepareTestEnv(t)
|
||||||
ctx, _ := contexttest.MockContext(t, "user2/repo1/projects/1/2")
|
ctx, _ := contexttest.MockContext(t, "user2/repo1/projects/1/2")
|
||||||
contexttest.LoadUser(t, ctx, 2)
|
contexttest.LoadUser(t, ctx, 2)
|
||||||
@@ -20,8 +20,8 @@ func TestCheckProjectBoardChangePermissions(t *testing.T) {
|
|||||||
ctx.SetParams(":id", "1")
|
ctx.SetParams(":id", "1")
|
||||||
ctx.SetParams(":boardID", "2")
|
ctx.SetParams(":boardID", "2")
|
||||||
|
|
||||||
project, board := checkProjectBoardChangePermissions(ctx)
|
project, column := checkProjectColumnChangePermissions(ctx)
|
||||||
assert.NotNil(t, project)
|
assert.NotNil(t, project)
|
||||||
assert.NotNil(t, board)
|
assert.NotNil(t, column)
|
||||||
assert.False(t, ctx.Written())
|
assert.False(t, ctx.Written())
|
||||||
}
|
}
|
||||||
|
@@ -1007,7 +1007,7 @@ func registerRoutes(m *web.Route) {
|
|||||||
m.Group("/{boardID}", func() {
|
m.Group("/{boardID}", func() {
|
||||||
m.Put("", web.Bind(forms.EditProjectColumnForm{}), org.EditProjectColumn)
|
m.Put("", web.Bind(forms.EditProjectColumnForm{}), org.EditProjectColumn)
|
||||||
m.Delete("", org.DeleteProjectColumn)
|
m.Delete("", org.DeleteProjectColumn)
|
||||||
m.Post("/default", org.SetDefaultProjectBoard)
|
m.Post("/default", org.SetDefaultProjectColumn)
|
||||||
|
|
||||||
m.Post("/move", org.MoveIssues)
|
m.Post("/move", org.MoveIssues)
|
||||||
})
|
})
|
||||||
@@ -1336,7 +1336,7 @@ func registerRoutes(m *web.Route) {
|
|||||||
m.Get("/new", repo.RenderNewProject)
|
m.Get("/new", repo.RenderNewProject)
|
||||||
m.Post("/new", web.Bind(forms.CreateProjectForm{}), repo.NewProjectPost)
|
m.Post("/new", web.Bind(forms.CreateProjectForm{}), repo.NewProjectPost)
|
||||||
m.Group("/{id}", func() {
|
m.Group("/{id}", func() {
|
||||||
m.Post("", web.Bind(forms.EditProjectColumnForm{}), repo.AddBoardToProjectPost)
|
m.Post("", web.Bind(forms.EditProjectColumnForm{}), repo.AddColumnToProjectPost)
|
||||||
m.Post("/delete", repo.DeleteProject)
|
m.Post("/delete", repo.DeleteProject)
|
||||||
|
|
||||||
m.Get("/edit", repo.RenderEditProject)
|
m.Get("/edit", repo.RenderEditProject)
|
||||||
@@ -1345,7 +1345,7 @@ func registerRoutes(m *web.Route) {
|
|||||||
|
|
||||||
m.Group("/{boardID}", func() {
|
m.Group("/{boardID}", func() {
|
||||||
m.Put("", web.Bind(forms.EditProjectColumnForm{}), repo.EditProjectColumn)
|
m.Put("", web.Bind(forms.EditProjectColumnForm{}), repo.EditProjectColumn)
|
||||||
m.Delete("", repo.DeleteProjectBoard)
|
m.Delete("", repo.DeleteProjectColumn)
|
||||||
m.Post("/default", repo.SetDefaultProjectColumn)
|
m.Post("/default", repo.SetDefaultProjectColumn)
|
||||||
|
|
||||||
m.Post("/move", repo.MoveIssues)
|
m.Post("/move", repo.MoveIssues)
|
||||||
|
@@ -522,7 +522,7 @@ type UserCreateProjectForm struct {
|
|||||||
UID int64 `binding:"Required"`
|
UID int64 `binding:"Required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// EditProjectColumnForm is a form for editing a project board
|
// EditProjectColumnForm is a form for editing a project column
|
||||||
type EditProjectColumnForm struct {
|
type EditProjectColumnForm struct {
|
||||||
Title string `binding:"Required;MaxSize(100)"`
|
Title string `binding:"Required;MaxSize(100)"`
|
||||||
Sorting int8
|
Sorting int8
|
||||||
|
@@ -65,7 +65,7 @@ var hiddenCommentTypeGroups = hiddenCommentTypeGroupsType{
|
|||||||
},
|
},
|
||||||
"project": {
|
"project": {
|
||||||
/*30*/ issues_model.CommentTypeProject,
|
/*30*/ issues_model.CommentTypeProject,
|
||||||
/*31*/ issues_model.CommentTypeProjectBoard,
|
/*31*/ issues_model.CommentTypeProjectColumn,
|
||||||
},
|
},
|
||||||
"issue_ref": {
|
"issue_ref": {
|
||||||
/*33*/ issues_model.CommentTypeChangeIssueRef,
|
/*33*/ issues_model.CommentTypeChangeIssueRef,
|
||||||
|
Reference in New Issue
Block a user