feat: store last seen date for users and present in stats and user lists, closes #9007

This commit is contained in:
Torkel Ödegaard
2017-08-09 10:36:41 +02:00
parent 26ad025705
commit e8a20643d6
15 changed files with 249 additions and 84 deletions
+10 -1
View File
@@ -62,6 +62,15 @@ func GetContextHandler() macaron.Handler {
ctx.Data["ctx"] = ctx
c.Map(ctx)
// update last seen at
// update last seen every 5min
if ctx.ShouldUpdateLastSeenAt() {
ctx.Logger.Debug("Updating last user_seen_at", "user_id", ctx.UserId)
if err := bus.Dispatch(&m.UpdateUserLastSeenAtCommand{UserId: ctx.UserId}); err != nil {
ctx.Logger.Error("Failed to update last_seen_at", "error", err)
}
}
}
}
@@ -99,7 +108,7 @@ func initContextWithUserSessionCookie(ctx *Context, orgId int64) bool {
query := m.GetSignedInUserQuery{UserId: userId, OrgId: orgId}
if err := bus.Dispatch(&query); err != nil {
ctx.Logger.Error("Failed to get user with id", "userId", userId)
ctx.Logger.Error("Failed to get user with id", "userId", userId, "error", err)
return false
}