mirror of
https://github.com/go-gitea/gitea.git
synced 2026-05-15 04:13:35 +02:00
fix: handle id=0 as remove-from-all-projects in UpdateIssueProject
This commit is contained in:
parent
56461206f5
commit
ae9fff3d3f
@ -293,7 +293,7 @@ func ViewProject(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
columns, err := project_model.GetProjectColumns(ctx, project.ID, db.ListOptionsAll)
|
||||
columns, err := project.GetColumns(ctx)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetProjectColumns", err)
|
||||
return
|
||||
@ -449,6 +449,14 @@ func UpdateIssueProject(ctx *context.Context) {
|
||||
}
|
||||
|
||||
projectIDs := ctx.FormStringInt64s("id")
|
||||
// Remove zero values - id=0 means "remove from all projects"
|
||||
filteredIDs := make([]int64, 0, len(projectIDs))
|
||||
for _, id := range projectIDs {
|
||||
if id != 0 {
|
||||
filteredIDs = append(filteredIDs, id)
|
||||
}
|
||||
}
|
||||
projectIDs = filteredIDs
|
||||
var failedIssues []int64
|
||||
for _, issue := range issues {
|
||||
if err := issues_model.IssueAssignOrRemoveProject(ctx, issue, ctx.Doer, projectIDs); err != nil {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user