fix(kanban): load full task when moving task between buckets

This commit is contained in:
kolaente 2025-03-21 16:59:20 +01:00
parent 6c08ce814b
commit 096de3382f
No known key found for this signature in database
GPG Key ID: F40E70337AB24C9B
1 changed files with 7 additions and 6 deletions

View File

@ -116,7 +116,8 @@ func (b *TaskBucket) Update(s *xorm.Session, a web.Auth) (err error) {
}
}
task, err := GetTaskByIDSimple(s, b.TaskID)
task := &Task{ID: b.TaskID}
err = task.ReadOne(s, a)
if err != nil {
return err
}
@ -124,7 +125,7 @@ func (b *TaskBucket) Update(s *xorm.Session, a web.Auth) (err error) {
// Check the bucket limit
// Only check the bucket limit if the task is being moved between buckets, allow reordering the task within a bucket
if b.BucketID != 0 && b.BucketID != oldTaskBucket.BucketID {
taskCount, err := checkBucketLimit(s, a, &task, bucket)
taskCount, err := checkBucketLimit(s, a, task, bucket)
if err != nil {
return err
}
@ -141,7 +142,7 @@ func (b *TaskBucket) Update(s *xorm.Session, a web.Auth) (err error) {
if task.isRepeating() {
oldTask := task
oldTask.Done = false
updateDone(&oldTask, &task)
updateDone(oldTask, task)
updateBucket = false
b.BucketID = oldTaskBucket.BucketID
}
@ -171,7 +172,7 @@ func (b *TaskBucket) Update(s *xorm.Session, a web.Auth) (err error) {
return
}
err = task.updateReminders(s, &task)
err = task.updateReminders(s, task)
if err != nil {
return err
}
@ -208,12 +209,12 @@ func (b *TaskBucket) Update(s *xorm.Session, a web.Auth) (err error) {
bucket.Count++
}
b.Task = &task
b.Task = task
b.Bucket = bucket
doer, _ := user.GetFromAuth(a)
return events.Dispatch(&TaskUpdatedEvent{
Task: &task,
Task: task,
Doer: doer,
})
}