fix(views): assign default position when creating new project views
When creating a new view without specifying a position, it defaulted to 0, causing it to always sort before all other views. Apply calculateDefaultPosition to assign a unique position based on the view ID, consistent with how projects, tasks, and buckets handle this. Fixes go-vikunja/vikunja#2319
This commit is contained in:
parent
a7e4a4f4af
commit
23d84e7811
|
|
@ -306,6 +306,12 @@ func createProjectView(s *xorm.Session, p *ProjectView, a web.Auth, createBacklo
|
|||
return
|
||||
}
|
||||
|
||||
p.Position = calculateDefaultPosition(p.ID, p.Position)
|
||||
_, err = s.Where("id = ?", p.ID).Update(p)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if p.ViewKind == ProjectViewKindKanban && createBacklogBucket && p.BucketConfigurationMode == BucketConfigurationModeManual {
|
||||
// Create default buckets for kanban view
|
||||
backlog := &Bucket{
|
||||
|
|
|
|||
Loading…
Reference in New Issue