From f5eb3c1bcb0c7e367f64bd8e5a0d2d5418f8e2ef Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Wed, 20 Jan 2016 07:59:56 -0600 Subject: PLT-7 adding loc for db calls audits and prefs --- api/context.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'api/context.go') diff --git a/api/context.go b/api/context.go index b6ffb1a29..fdca52085 100644 --- a/api/context.go +++ b/api/context.go @@ -233,7 +233,7 @@ func GetProtocol(r *http.Request) string { func (c *Context) LogAudit(extraInfo string) { audit := &model.Audit{UserId: c.Session.UserId, IpAddress: c.IpAddress, Action: c.Path, ExtraInfo: extraInfo, SessionId: c.Session.Id} - if r := <-Srv.Store.Audit().Save(audit); r.Err != nil { + if r := <-Srv.Store.Audit().Save(c.T, audit); r.Err != nil { c.LogError(r.Err) } } @@ -245,7 +245,7 @@ func (c *Context) LogAuditWithUserId(userId, extraInfo string) { } audit := &model.Audit{UserId: userId, IpAddress: c.IpAddress, Action: c.Path, ExtraInfo: extraInfo, SessionId: c.Session.Id} - if r := <-Srv.Store.Audit().Save(audit); r.Err != nil { + if r := <-Srv.Store.Audit().Save(c.T, audit); r.Err != nil { c.LogError(r.Err) } } -- cgit v1.2.3-1-g7c22 From 5b2ec623473abeb44577fbfc9122b792a94a5184 Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Wed, 20 Jan 2016 08:33:26 -0600 Subject: PLT-7 adding loc db calls for team table --- api/context.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'api/context.go') diff --git a/api/context.go b/api/context.go index fdca52085..13f0f2c42 100644 --- a/api/context.go +++ b/api/context.go @@ -387,7 +387,7 @@ func (c *Context) setTeamURL(url string, valid bool) { } func (c *Context) SetTeamURLFromSession() { - if result := <-Srv.Store.Team().Get(c.Session.TeamId); result.Err == nil { + if result := <-Srv.Store.Team().Get(c.T, c.Session.TeamId); result.Err == nil { c.setTeamURL(c.GetSiteURL()+"/"+result.Data.(*model.Team).Name, true) } } -- cgit v1.2.3-1-g7c22 From 3ac5ecf0e98823cab22c77d3a56393cbe6bbc19a Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Wed, 20 Jan 2016 10:18:11 -0600 Subject: PLT-7 adding loc db calls for session table --- api/context.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'api/context.go') diff --git a/api/context.go b/api/context.go index 13f0f2c42..2dcf51e10 100644 --- a/api/context.go +++ b/api/context.go @@ -162,7 +162,7 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { } if len(token) != 0 { - session := GetSession(token) + session := GetSession(c.T, token) if session == nil || session.IsExpired() { c.RemoveSessionCookie(w, r) @@ -515,14 +515,14 @@ func Handle404(w http.ResponseWriter, r *http.Request) { RenderWebError(err, w, r) } -func GetSession(token string) *model.Session { +func GetSession(T goi18n.TranslateFunc, token string) *model.Session { var session *model.Session if ts, ok := sessionCache.Get(token); ok { session = ts.(*model.Session) } if session == nil { - if sessionResult := <-Srv.Store.Session().Get(token); sessionResult.Err != nil { + if sessionResult := <-Srv.Store.Session().Get(T, token); sessionResult.Err != nil { l4g.Error("Invalid session token=" + token + ", err=" + sessionResult.Err.DetailedError) } else { session = sessionResult.Data.(*model.Session) @@ -551,9 +551,9 @@ func GetMultiSessionCookieTokens(r *http.Request) []string { return []string{} } -func FindMultiSessionForTeamId(r *http.Request, teamId string) (int64, *model.Session) { +func FindMultiSessionForTeamId(T goi18n.TranslateFunc, r *http.Request, teamId string) (int64, *model.Session) { for index, token := range GetMultiSessionCookieTokens(r) { - s := GetSession(token) + s := GetSession(T, token) if s != nil && !s.IsExpired() && s.TeamId == teamId { return int64(index), s } -- cgit v1.2.3-1-g7c22 From 75f8729e2d25467500778e633c45c97e78a8f7a0 Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Wed, 20 Jan 2016 12:43:44 -0600 Subject: PLT-7 adding loc db calls for users table --- api/context.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'api/context.go') diff --git a/api/context.go b/api/context.go index 2dcf51e10..59db724c4 100644 --- a/api/context.go +++ b/api/context.go @@ -195,7 +195,7 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { if c.Err == nil && h.isUserActivity && token != "" && len(c.Session.UserId) > 0 { go func() { - if err := (<-Srv.Store.User().UpdateUserAndSessionActivity(c.Session.UserId, c.Session.Id, model.GetMillis())).Err; err != nil { + if err := (<-Srv.Store.User().UpdateUserAndSessionActivity(c.T, c.Session.UserId, c.Session.Id, model.GetMillis())).Err; err != nil { l4g.Error("Failed to update LastActivityAt for user_id=%v and session_id=%v, err=%v", c.Session.UserId, c.Session.Id, err) } }() -- cgit v1.2.3-1-g7c22