diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2022-06-30 23:55:08 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-30 23:55:08 +0800 |
commit | 184a7d4195baffb169f24f4e9a4524f8d4045e91 (patch) | |
tree | b7d620626be91e789115d41d9829518e4119c4a1 /routers/web/repo/projects.go | |
parent | db3355cb1aa206fc9f1cf786543607204f628218 (diff) | |
download | gitea-184a7d4195baffb169f24f4e9a4524f8d4045e91.tar.gz gitea-184a7d4195baffb169f24f4e9a4524f8d4045e91.zip |
Check if project has the same repository id with issue when assign project to issue (#20133)
* Check if project has the same repository id with issue when assign project to issue
* Check if issue's repository id match project's repository id
* Add more permission checking
* Remove invalid argument
* Fix errors
* Add generic check
* Remove duplicated check
* Return error + add check for new issues
* Apply suggestions from code review
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
Co-authored-by: 6543 <6543@obermui.de>
Diffstat (limited to 'routers/web/repo/projects.go')
-rw-r--r-- | routers/web/repo/projects.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/routers/web/repo/projects.go b/routers/web/repo/projects.go index 0aa9b5effc..f054ad6e54 100644 --- a/routers/web/repo/projects.go +++ b/routers/web/repo/projects.go @@ -5,6 +5,7 @@ package repo import ( + "errors" "fmt" "net/http" "net/url" @@ -633,10 +634,17 @@ func MoveIssues(ctx *context.Context) { } if len(movedIssues) != len(form.Issues) { - ctx.ServerError("IssuesNotFound", err) + ctx.ServerError("some issues do not exist", errors.New("some issues do not exist")) return } + for _, issue := range movedIssues { + if issue.RepoID != project.RepoID { + ctx.ServerError("Some issue's repoID is not equal to project's repoID", errors.New("Some issue's repoID is not equal to project's repoID")) + return + } + } + if err = project_model.MoveIssuesOnProjectBoard(board, sortedIssueIDs); err != nil { ctx.ServerError("MoveIssuesOnProjectBoard", err) return |