Only update session activity on specific endpoints (#7549)

This commit is contained in:
Joram Wilander
2017-10-03 14:16:33 -04:00
committed by Chris
parent 5e69ce099f
commit 3e144f82e2
4 changed files with 5 additions and 1 deletions

View File

@@ -716,6 +716,8 @@ func viewChannel(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
c.App.UpdateLastActivityAtIfNeeded(c.Session)
// Returning {"status": "OK", ...} for backwards compatability
resp := &model.ChannelViewResponse{
Status: "OK",

View File

@@ -157,7 +157,6 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
c.Err = model.NewAppError("ServeHTTP", "api.context.token_provided.app_error", nil, "token="+token, http.StatusUnauthorized)
} else {
c.Session = *session
c.App.UpdateLastActivityAtIfNeeded(*session)
}
}

View File

@@ -69,6 +69,7 @@ func createPost(c *Context, w http.ResponseWriter, r *http.Request) {
}
c.App.SetStatusOnline(c.Session.UserId, c.Session.Id, false)
c.App.UpdateLastActivityAtIfNeeded(c.Session)
w.WriteHeader(http.StatusCreated)
w.Write([]byte(rp.ToJson()))

View File

@@ -121,6 +121,7 @@ func getUser(c *Context, w http.ResponseWriter, r *http.Request) {
} else {
app.SanitizeProfile(user, c.IsSystemAdmin())
}
c.App.UpdateLastActivityAtIfNeeded(c.Session)
w.Header().Set(model.HEADER_ETAG_SERVER, etag)
w.Write([]byte(user.ToJson()))
return
@@ -369,6 +370,7 @@ func getUsers(c *Context, w http.ResponseWriter, r *http.Request) {
if len(etag) > 0 {
w.Header().Set(model.HEADER_ETAG_SERVER, etag)
}
c.App.UpdateLastActivityAtIfNeeded(c.Session)
w.Write([]byte(model.UserListToJson(profiles)))
}
}