fix(typesense): correctly index assignee changes on tasks
Some checks failed
continuous-integration/drone/push Build is failing

This change fixes a bug where adding or removing an assignee to a task would not update the index in Typesense, causing filter queries for that assignee to return incorrect data. This was caused by the events being dispatched by the task update process not containing all the data.

Resolves https://github.com/go-vikunja/vikunja/issues/255
This commit is contained in:
kolaente 2024-06-05 10:36:25 +02:00
parent e56b2232bb
commit f131289d32
Signed by: konrad
GPG Key ID: F40E70337AB24C9B

View File

@ -189,11 +189,18 @@ func (la *TaskAssginee) Delete(s *xorm.Session, a web.Auth) (err error) {
return err
}
return events.Dispatch(&TaskAssigneeDeletedEvent{
err = events.Dispatch(&TaskAssigneeDeletedEvent{
Task: &task,
Assignee: &user.User{ID: la.UserID},
Doer: doer,
})
if err != nil {
return err
}
return events.Dispatch(&TaskUpdatedEvent{
Task: &task,
Doer: doer,
})
}
// Create adds a new assignee to a task
@ -281,7 +288,7 @@ func (t *Task) addNewAssigneeByID(s *xorm.Session, newAssigneeID int64, project
return err
}
err = events.Dispatch(&TaskUpdatedEvent{
Task: t,
Task: &task,
Doer: doer,
})
if err != nil {