mirror of
https://github.com/go-vikunja/vikunja.git
synced 2026-03-08 23:03:29 -05:00
fix: handle deleted user in saved filter view event listener
Use a separate error variable for the user lookup in UpdateTaskInSavedFilterViews so that ErrUserDoesNotExist does not pollute the named return `err`. The `:=` inside the for loop shadowed the outer `err`, leaving it set to the stale user-not-found error, which caused the handler to be poisoned. Closes #2359
This commit is contained in:
@@ -586,15 +586,15 @@ func (l *UpdateTaskInSavedFilterViews) Handle(msg *message.Message) (err error)
|
||||
|
||||
var fallbackTimezone string
|
||||
if event.Doer != nil {
|
||||
var u *user.User
|
||||
u, err = user.GetUserByID(s, event.Doer.GetID())
|
||||
if err == nil {
|
||||
u, userErr := user.GetUserByID(s, event.Doer.GetID())
|
||||
if userErr == nil {
|
||||
fallbackTimezone = u.Timezone
|
||||
// When a link share triggered this event, the user id will be 0, and thus this fails.
|
||||
// Only passing the value along when the user was retrieved successfully ensures the whole handler
|
||||
// does not fail because of that.
|
||||
// When the fallback is empty, it will be handled later anyhow.
|
||||
}
|
||||
// When a link share triggered this event, the user id will be 0, and thus this fails.
|
||||
// Similarly, when the doer has been deleted, the user will not exist.
|
||||
// Only passing the value along when the user was retrieved successfully ensures the whole handler
|
||||
// does not fail because of that.
|
||||
// When the fallback is empty, it will be handled later anyhow.
|
||||
}
|
||||
|
||||
taskBuckets := []*TaskBucket{}
|
||||
|
||||
Reference in New Issue
Block a user