1
0

fix(kanban): dispatch task updated event when task is moved between buckets

This fixes a bug where a task would not be indexed in Typesense when its bucket changed.
This commit is contained in:
kolaente 2024-07-12 13:29:15 +02:00
parent 62412ce29b
commit e5e0db1f6a
No known key found for this signature in database
GPG Key ID: F40E70337AB24C9B

View File

@ -28,7 +28,7 @@ type TaskBucket struct {
TaskID int64 `xorm:"bigint not null index" json:"task_id"` TaskID int64 `xorm:"bigint not null index" json:"task_id"`
ProjectViewID int64 `xorm:"bigint not null index" json:"project_view_id" param:"view"` ProjectViewID int64 `xorm:"bigint not null index" json:"project_view_id" param:"view"`
ProjectID int64 `xorm:"-" json:"-" param:"project"` ProjectID int64 `xorm:"-" json:"-" param:"project"`
TaskDone bool `xorm:"-" json:"task_done,omitempty"` TaskDone bool `xorm:"-" json:"task_done"`
web.Rights `xorm:"-" json:"-"` web.Rights `xorm:"-" json:"-"`
web.CRUDable `xorm:"-" json:"-"` web.CRUDable `xorm:"-" json:"-"`
@ -147,14 +147,6 @@ func (b *TaskBucket) Update(s *xorm.Session, a web.Auth) (err error) {
return err return err
} }
doer, _ := user.GetFromAuth(a)
err = events.Dispatch(&TaskUpdatedEvent{
Task: &task,
Doer: doer,
})
if err != nil {
return err
}
} }
if updateBucket { if updateBucket {
@ -175,5 +167,9 @@ func (b *TaskBucket) Update(s *xorm.Session, a web.Auth) (err error) {
b.TaskDone = task.Done b.TaskDone = task.Done
return doer, _ := user.GetFromAuth(a)
return events.Dispatch(&TaskUpdatedEvent{
Task: &task,
Doer: doer,
})
} }