mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Only update session activity on specific endpoints (#7549)
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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()))
|
||||
|
||||
@@ -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)))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user