Fixing code review issues
Этот коммит содержится в:
@@ -101,7 +101,7 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
// Attempt to parse the token from the cookie
|
// Attempt to parse the token from the cookie
|
||||||
if len(token) == 0 {
|
if len(token) == 0 {
|
||||||
tokens := GetMultiSessionCookie(r)
|
tokens := GetMultiSessionCookieTokens(r)
|
||||||
if len(tokens) > 0 {
|
if len(tokens) > 0 {
|
||||||
// If there is only 1 token in the cookie then just use it like normal
|
// If there is only 1 token in the cookie then just use it like normal
|
||||||
if len(tokens) == 1 {
|
if len(tokens) == 1 {
|
||||||
@@ -527,7 +527,7 @@ func GetSession(token string) *model.Session {
|
|||||||
return 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 {
|
if multiCookie, err := r.Cookie(model.SESSION_COOKIE_TOKEN); err == nil {
|
||||||
multiToken := multiCookie.Value
|
multiToken := multiCookie.Value
|
||||||
|
|
||||||
@@ -540,7 +540,7 @@ func GetMultiSessionCookie(r *http.Request) []string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func FindMultiSessionForTeamId(r *http.Request, teamId string) (int64, *model.Session) {
|
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)
|
s := GetSession(token)
|
||||||
if s != nil && !s.IsExpired() && s.TeamId == teamId {
|
if s != nil && !s.IsExpired() && s.TeamId == teamId {
|
||||||
return int64(index), s
|
return int64(index), s
|
||||||
|
|||||||
@@ -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)
|
w.Header().Set(model.HEADER_TOKEN, session.Token)
|
||||||
|
|
||||||
tokens := GetMultiSessionCookie(r)
|
tokens := GetMultiSessionCookieTokens(r)
|
||||||
multiToken := ""
|
multiToken := ""
|
||||||
seen := make(map[string]string)
|
seen := make(map[string]string)
|
||||||
seen[session.TeamId] = session.TeamId
|
seen[session.TeamId] = session.TeamId
|
||||||
|
|||||||
@@ -96,8 +96,7 @@ func ShouldSendEvent(webCon *WebConn, msg *model.Message) bool {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Don't share a user's view events with other users
|
// Don't share a user's view events with other users
|
||||||
// but you still need to share it with yourself
|
if msg.Action == model.ACTION_CHANNEL_VIEWED {
|
||||||
if webCon.UserId != msg.UserId && msg.Action == model.ACTION_CHANNEL_VIEWED {
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user