MM-31062: Rewrite empty string checks to be more idiomatic (#16587)

https://mattermost.atlassian.net/browse/MM-31062

```release-note
NONE
```
Этот коммит содержится в:
Agniva De Sarker
2020-12-22 19:20:59 +05:30
коммит произвёл GitHub
родитель 1a131b54af
Коммит 6487d0ca91
25 изменённых файлов: 54 добавлений и 54 удалений

Просмотреть файл

@@ -188,7 +188,7 @@ func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
token, tokenLocation := app.ParseAuthTokenFromRequest(r)
if len(token) != 0 && tokenLocation != app.TokenLocationCloudHeader {
if token != "" && tokenLocation != app.TokenLocationCloudHeader {
session, err := c.App.GetSession(token)
if err != nil {
c.Log.Info("Invalid session", mlog.Err(err))
@@ -210,7 +210,7 @@ func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
h.checkCSRFToken(c, r, token, tokenLocation, session)
} else if len(token) != 0 && c.App.Srv().License() != nil && *c.App.Srv().License().Features.Cloud && tokenLocation == app.TokenLocationCloudHeader {
} else if token != "" && c.App.Srv().License() != nil && *c.App.Srv().License().Features.Cloud && tokenLocation == app.TokenLocationCloudHeader {
// Check to see if this provided token matches our CWS Token
session, err := c.App.GetCloudSession(token)
if err != nil {

Просмотреть файл

@@ -38,7 +38,7 @@ func loginWithSaml(c *Context, w http.ResponseWriter, r *http.Request) {
relayProps := map[string]string{}
relayState := ""
if len(action) != 0 {
if action != "" {
relayProps["team_id"] = teamId
relayProps["action"] = action
if action == model.OAUTH_ACTION_EMAIL_TO_SSO {
@@ -46,7 +46,7 @@ func loginWithSaml(c *Context, w http.ResponseWriter, r *http.Request) {
}
}
if len(redirectTo) != 0 {
if redirectTo != "" {
relayProps["redirect_to"] = redirectTo
}