summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
author=Corey Hulen <corey@hulen.com>2015-10-22 18:06:22 -0700
committer=Corey Hulen <corey@hulen.com>2015-10-22 18:06:22 -0700
commit079f047540504c987c7f97fc46e296ea1fc9aa78 (patch)
tree7feef3e4bb5de72f40b5475be1059bfa613a9c04 /api
parentab18616725fc7c3df00215e63830f6ec0a05976c (diff)
downloadchat-079f047540504c987c7f97fc46e296ea1fc9aa78.tar.gz
chat-079f047540504c987c7f97fc46e296ea1fc9aa78.tar.bz2
chat-079f047540504c987c7f97fc46e296ea1fc9aa78.zip
Fixing code review issues
Diffstat (limited to 'api')
-rw-r--r--api/context.go6
-rw-r--r--api/user.go2
-rw-r--r--api/web_team_hub.go3
3 files changed, 5 insertions, 6 deletions
diff --git a/api/context.go b/api/context.go
index 28d6951da..9be3e85cc 100644
--- a/api/context.go
+++ b/api/context.go
@@ -101,7 +101,7 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// Attempt to parse the token from the cookie
if len(token) == 0 {
- tokens := GetMultiSessionCookie(r)
+ tokens := GetMultiSessionCookieTokens(r)
if len(tokens) > 0 {
// If there is only 1 token in the cookie then just use it like normal
if len(tokens) == 1 {
@@ -527,7 +527,7 @@ func GetSession(token string) *model.Session {
return session
}
-func GetMultiSessionCookie(r *http.Request) []string {
+func GetMultiSessionCookieTokens(r *http.Request) []string {
if multiCookie, err := r.Cookie(model.SESSION_COOKIE_TOKEN); err == nil {
multiToken := multiCookie.Value
@@ -540,7 +540,7 @@ func GetMultiSessionCookie(r *http.Request) []string {
}
func FindMultiSessionForTeamId(r *http.Request, teamId string) (int64, *model.Session) {
- for index, token := range GetMultiSessionCookie(r) {
+ for index, token := range GetMultiSessionCookieTokens(r) {
s := GetSession(token)
if s != nil && !s.IsExpired() && s.TeamId == teamId {
return int64(index), s
diff --git a/api/user.go b/api/user.go
index 4c53bd104..aec975524 100644
--- a/api/user.go
+++ b/api/user.go
@@ -429,7 +429,7 @@ func Login(c *Context, w http.ResponseWriter, r *http.Request, user *model.User,
w.Header().Set(model.HEADER_TOKEN, session.Token)
- tokens := GetMultiSessionCookie(r)
+ tokens := GetMultiSessionCookieTokens(r)
multiToken := ""
seen := make(map[string]string)
seen[session.TeamId] = session.TeamId
diff --git a/api/web_team_hub.go b/api/web_team_hub.go
index 12a14da17..6a25b7d3d 100644
--- a/api/web_team_hub.go
+++ b/api/web_team_hub.go
@@ -96,8 +96,7 @@ func ShouldSendEvent(webCon *WebConn, msg *model.Message) bool {
}
} else {
// Don't share a user's view events with other users
- // but you still need to share it with yourself
- if webCon.UserId != msg.UserId && msg.Action == model.ACTION_CHANNEL_VIEWED {
+ if msg.Action == model.ACTION_CHANNEL_VIEWED {
return false
}