fix(background): use targeted column update when removing background
Fixes #2552. RemoveProjectBackground was passing a minimal Project struct (only ID set) through UpdateProject, which always includes 'title' in its Cols() list. This caused XORM to write the zero-value empty title to the DB, wiping the real project title. Now uses ClearProjectBackground which only updates background_file_id and background_blur_hash.
This commit is contained in:
parent
bf86bee690
commit
d5051c97e4
|
|
@ -443,7 +443,7 @@ func RemoveProjectBackground(c *echo.Context) error {
|
|||
s := db.NewSession()
|
||||
defer s.Close()
|
||||
|
||||
project, auth, err := checkProjectBackgroundWritePermissions(s, c)
|
||||
project, _, err := checkProjectBackgroundWritePermissions(s, c)
|
||||
if err != nil {
|
||||
_ = s.Rollback()
|
||||
return err
|
||||
|
|
@ -455,10 +455,7 @@ func RemoveProjectBackground(c *echo.Context) error {
|
|||
return err
|
||||
}
|
||||
|
||||
project.BackgroundFileID = 0
|
||||
project.BackgroundInformation = nil
|
||||
project.BackgroundBlurHash = ""
|
||||
err = models.UpdateProject(s, project, auth, true)
|
||||
err = models.ClearProjectBackground(s, project.ID)
|
||||
if err != nil {
|
||||
_ = s.Rollback()
|
||||
return err
|
||||
|
|
|
|||
Loading…
Reference in New Issue