This commit is contained in:
Lunny Xiao 2024-04-28 15:17:03 +08:00
parent 1f4852e551
commit c2158063c1
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A
3 changed files with 15 additions and 1 deletions

View File

@ -162,7 +162,7 @@ func NewBoard(ctx context.Context, board *Board) error {
return err
}
if maxSorting > 0 {
board.Sorting = maxSorting
board.Sorting = maxSorting + 1
}
_, err := db.GetEngine(ctx).Insert(board)

View File

@ -383,6 +383,10 @@ func UpdateIssueProject(ctx *context.Context) {
ctx.ServerError("LoadProjects", err)
return
}
if _, err := issues.LoadRepositories(ctx); err != nil {
ctx.ServerError("LoadProjects", err)
return
}
projectID := ctx.FormInt64("id")
var dstColumnID int64
@ -392,6 +396,12 @@ func UpdateIssueProject(ctx *context.Context) {
ctx.ServerError("GetProjectByID", err)
return
}
for _, issue := range issues {
if dstProject.RepoID != ctx.Repo.Repository.ID && dstProject.OwnerID != issue.Repo.OwnerID {
ctx.Error(http.StatusBadRequest, "project doesn't belong to the repository")
return
}
}
dstDefaultColumn, err := dstProject.GetDefaultBoard(ctx)
if err != nil {
ctx.ServerError("GetDefaultBoard", err)

View File

@ -1339,6 +1339,10 @@ func CompareAndPullRequestPost(ctx *context.Context) {
ctx.ServerError("GetProjectByID", err)
return
}
if dstProject.RepoID != ctx.Repo.Repository.ID && dstProject.OwnerID != repo.OwnerID {
ctx.Error(http.StatusBadRequest, "project doesn't belong to the repository")
return
}
dstDefaultColumn, err := dstProject.GetDefaultBoard(ctx)
if err != nil {
ctx.ServerError("GetDefaultBoard", err)