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).
This commit is contained in:
kolaente 2026-04-09 12:37:22 +02:00 committed by kolaente
parent 1e784aa194
commit 88b534776a
1 changed files with 7 additions and 0 deletions

View File

@ -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
}
}
}