From 88b534776affb7270ab07fc1d12a53e514f9c202 Mon Sep 17 00:00:00 2001 From: kolaente Date: Thu, 9 Apr 2026 12:37:22 +0200 Subject: [PATCH] fix(kanban): skip upsert when repeating task already in default bucket (#2573) When a repeating task dropped on the done bucket is already in the view's default bucket, the upsert would try to UPDATE with an unchanged bucket_id. MySQL reports 0 affected rows for unchanged updates, so upsert fell through to INSERT and hit the unique constraint on (task_id, project_view_id). --- pkg/models/kanban_task_bucket.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/models/kanban_task_bucket.go b/pkg/models/kanban_task_bucket.go index c8794201e..0b2b06eaf 100644 --- a/pkg/models/kanban_task_bucket.go +++ b/pkg/models/kanban_task_bucket.go @@ -152,6 +152,13 @@ func updateTaskBucket(s *xorm.Session, a web.Auth, b *TaskBucket) (err error) { if err != nil { return err } + // If the task is already in the default bucket, skip the + // upsert — MySQL's UPDATE returns 0 affected rows when + // the value is unchanged, which would make upsert fall + // through to INSERT and hit the unique constraint. + if b.BucketID == oldTaskBucket.BucketID { + updateBucket = false + } } }