Fix marking a task as done & done at dates when marking it as done through a bucket
continuous-integration/drone/pr Build was killed Details

This commit is contained in:
kolaente 2021-03-23 22:32:05 +01:00
parent 0086cf12e5
commit 4a3298916d
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 5 additions and 5 deletions

View File

@ -738,7 +738,7 @@ func checkBucketLimit(s *xorm.Session, t *Task, bucket *Bucket) (err error) {
func setTaskBucket(s *xorm.Session, task *Task, originalTask *Task, doCheckBucketLimit bool) (err error) {
// Make sure we have a bucket
var bucket *Bucket
if task.Done {
if task.Done && originalTask != nil && !originalTask.Done {
bucket, err := getDoneBucketForList(s, task.ListID)
if err != nil {
return err
@ -777,7 +777,7 @@ func setTaskBucket(s *xorm.Session, task *Task, originalTask *Task, doCheckBucke
}
}
if bucket.IsDoneBucket {
if bucket.IsDoneBucket && originalTask != nil && !originalTask.Done {
task.Done = true
}
@ -921,9 +921,6 @@ func (t *Task) Update(s *xorm.Session, a web.Auth) (err error) {
ot.Reminders[i] = r.Reminder
}
// When a repeating task is marked as done, we update all deadlines and reminders and set it as undone
updateDone(&ot, t)
// Update the assignees
if err := ot.updateTaskAssignees(s, t.Assignees, a); err != nil {
return err
@ -959,6 +956,9 @@ func (t *Task) Update(s *xorm.Session, a web.Auth) (err error) {
return err
}
// When a repeating task is marked as done, we update all deadlines and reminders and set it as undone
updateDone(&ot, t)
// If the task is being moved between lists, make sure to move the bucket + index as well
if t.ListID != 0 && ot.ListID != t.ListID {
latestTask := &Task{}