Chore: Add context to user (#39649)

* Add context to user

* Add context for enterprise

* Add context for UpdateUserLastSeenAtCommand

* Remove xorm
This commit is contained in:
idafurjes
2021-10-04 15:46:09 +02:00
committed by GitHub
parent 42d7c32759
commit f4f0d74838
11 changed files with 152 additions and 145 deletions

View File

@@ -132,7 +132,7 @@ func (h *ContextHandler) Middleware(mContext *macaron.Context) {
// update last seen every 5min
if reqContext.ShouldUpdateLastSeenAt() {
reqContext.Logger.Debug("Updating last user_seen_at", "user_id", reqContext.UserId)
if err := bus.Dispatch(&models.UpdateUserLastSeenAtCommand{UserId: reqContext.UserId}); err != nil {
if err := bus.DispatchCtx(mContext.Req.Context(), &models.UpdateUserLastSeenAtCommand{UserId: reqContext.UserId}); err != nil {
reqContext.Logger.Error("Failed to update last_seen_at", "error", err)
}
}