fix(project): remove non-existent columns from UpdateProject column list
The UpdateProject function referenced done_bucket_id and default_bucket_id in its column update list, but these columns belong to the project_views table, not the projects table. This caused SQL errors when archiving or updating a project on MySQL/PostgreSQL. Also adds a test for archiving a non-archived project. Fixes #2459
This commit is contained in:
parent
ea54f3eb85
commit
88c2f0a289
|
|
@ -1013,8 +1013,6 @@ func UpdateProject(s *xorm.Session, project *Project, auth web.Auth, updateProje
|
|||
"hex_color",
|
||||
"parent_project_id",
|
||||
"position",
|
||||
"done_bucket_id",
|
||||
"default_bucket_id",
|
||||
}
|
||||
if project.Description != "" {
|
||||
colsToUpdate = append(colsToUpdate, "description")
|
||||
|
|
|
|||
|
|
@ -193,4 +193,10 @@ func TestArchived(t *testing.T) {
|
|||
|
||||
taskTests("36", models.ErrCodeProjectIsArchived, t)
|
||||
})
|
||||
// Archiving a non-archived project should work
|
||||
t.Run("archive non-archived project", func(t *testing.T) {
|
||||
rec, err := testProjectHandler.testUpdateWithUser(nil, map[string]string{"project": "1"}, `{"title":"Test1","is_archived":true}`)
|
||||
require.NoError(t, err)
|
||||
assert.Contains(t, rec.Body.String(), `"is_archived":true`)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue