Skip to content

Commit

Permalink
Warn instead of Error on unrecognized user tz (#1859)
Browse files Browse the repository at this point in the history
* Warn instead of Error on unrecognized user tz

Instead of erroring out on `/playbook todo` or the weekly digest message, just log a warning when a user's timezone isn't recognized:

```
{"timestamp":"2023-07-21 14:03:56.435 -03:00","level":"warn","msg":"failed to get user timezone","caller":"app/plugin_api.go:979","plugin_id":"playbooks","error":"unknown time zone Asia/Jerusalem2","user_id":"soa5qdiwnig8dkmekej37p8gmw","plugin_caller":"github.com/mattermost/mattermost-plugin-playbooks/server/app/playbook_run_service.go:2262"}
```

In practice, this won't occur because the timezone is really invalid, but because the operating system lacks the necessary tzdata.

* e2e tests on mattermost-cloud:latest
  • Loading branch information
lieut-data committed Jul 24, 2023
1 parent 36dceb5 commit ed9c289
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 347,7 @@ jobs:
ports:
- 9200:9200
mattermost-server:
image: mattermost/mm-ee-test:prerelease
image: mattermost/mattermost-cloud:latest
env:
DB_HOST: postgres
DB_PORT_NUMBER: 5432
Expand Down
4 changes: 3 additions & 1 deletion server/app/playbook_run_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -2257,7 2257,9 @@ func (s *PlaybookRunServiceImpl) buildTodoDigestMessage(userID string, force boo

timezone, err := timeutils.GetUserTimezone(user)
if err != nil {
return nil, err
logrus.WithError(err).WithFields(logrus.Fields{
"user_id": user.Id,
}).Warn("failed to get user timezone")
}

part2 := buildAssignedTaskMessageSummary(digestMessageItems.assignedRuns, user.Locale, timezone, !force)
Expand Down

0 comments on commit ed9c289

Please sign in to comment.