Skip to content

Commit

Permalink
Merge pull request #384 from jovandeginste/fix-stats
Browse files Browse the repository at this point in the history
fix(user): Set context of user from request
  • Loading branch information
jovandeginste authored Jan 6, 2025
2 parents 1195f71 + 7d6778b commit aacd657
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pkg/app/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,14 @@ func (a *App) setUser(c echo.Context) error {

func (a *App) getCurrentUser(c echo.Context) *database.User {
d := c.Get("user_info")
if d == nil {
return database.AnonymousUser()
}

u, ok := d.(*database.User)
if !ok {
return database.AnonymousUser()
u = database.AnonymousUser()
}

u.SetContext(c.Request().Context())

return u
}

Expand Down

0 comments on commit aacd657

Please sign in to comment.