From 3bafaa7101db22f9bdb6a34ae6f06fc5c00a80db Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Mon, 18 Nov 2024 16:02:05 +0000 Subject: [PATCH] fix(tasks): also delete corresponding task positions (#2840) Closes [#348](https://github.com/go-vikunja/vikunja/issues/348) When moving a project, the old task bucket entries (project, saved filters) will be removed, but not the corresponding position. This has the effect that the saved_filter event hook UpdateTaskInSavedFilterViews wrongly assumes that the task doesn't need to be re-added to the saved filter since the position part still exists. Reviewed-on: https://kolaente.dev/vikunja/vikunja/pulls/2840 Co-authored-by: Maximilian Bosch Co-committed-by: Maximilian Bosch --- pkg/models/tasks.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/models/tasks.go b/pkg/models/tasks.go index d75c969f0..b221d5df1 100644 --- a/pkg/models/tasks.go +++ b/pkg/models/tasks.go @@ -956,6 +956,10 @@ func (t *Task) Update(s *xorm.Session, a web.Auth) (err error) { if err != nil { return err } + _, err = s.Where("task_id = ?", t.ID).Delete(&TaskPosition{}) + if err != nil { + return err + } for _, view := range views { var bucketID = view.DoneBucketID