fix(filter): do not try to set timezone when doer does not exist

Resolves https://vikunja.sentry.io/issues/6025547266/events/e0d0a5fdf01c46a2ac9101d94ab4f304/
This commit is contained in:
kolaente
2025-03-23 19:08:11 +01:00
parent 8489cf57f6
commit 063753a543

View File

@@ -673,13 +673,16 @@ func (l *UpdateTaskInSavedFilterViews) Handle(msg *message.Message) (err error)
}
var fallbackTimezone string
u, err := user.GetUserByID(s, event.Doer.GetID())
if err == 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.
if event.Doer != nil {
var u *user.User
u, err = user.GetUserByID(s, event.Doer.GetID())
if err == 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.
}
}
taskBuckets := []*TaskBucket{}