From 23d84e7811458d5cefc049f93d238c2f0a7ddfd8 Mon Sep 17 00:00:00 2001 From: kolaente Date: Mon, 2 Mar 2026 08:34:42 +0100 Subject: [PATCH] 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 --- pkg/models/project_view.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/models/project_view.go b/pkg/models/project_view.go index d77487c75..fce6798de 100644 --- a/pkg/models/project_view.go +++ b/pkg/models/project_view.go @@ -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{