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 удалений

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

@@ -33,7 +33,7 @@ func (s *LocalCacheRoleStore) handleClusterInvalidateRolePermissions(msg *model.
}
func (s LocalCacheRoleStore) Save(role *model.Role) (*model.Role, error) {
if len(role.Name) != 0 {
if role.Name != "" {
defer s.rootStore.doInvalidateCacheCluster(s.rootStore.roleCache, role.Name)
defer s.rootStore.doClearCacheCluster(s.rootStore.rolePermissionsCache)
}

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

@@ -22,7 +22,7 @@ func (s *LocalCacheSchemeStore) handleClusterInvalidateScheme(msg *model.Cluster
}
func (s LocalCacheSchemeStore) Save(scheme *model.Scheme) (*model.Scheme, error) {
if len(scheme.Id) != 0 {
if scheme.Id != "" {
defer s.rootStore.doInvalidateCacheCluster(s.rootStore.schemeCache, scheme.Id)
}
return s.SchemeStore.Save(scheme)

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

@@ -57,7 +57,7 @@ func (s SqlAuditStore) Get(userId string, offset int, limit int) (model.Audits,
Limit(uint64(limit)).
Offset(uint64(offset))
if len(userId) != 0 {
if userId != "" {
query = query.Where(sq.Eq{"UserId": userId})
}

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

@@ -91,7 +91,7 @@ func (s *SqlGroupStore) createIndexesIfNotExists() {
}
func (s *SqlGroupStore) Create(group *model.Group) (*model.Group, error) {
if len(group.Id) != 0 {
if group.Id != "" {
return nil, store.NewErrInvalidInput("Group", "id", group.Id)
}

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

@@ -286,7 +286,7 @@ func (us SqlUserStore) UpdateAuthData(userId string, service string, authData *s
AuthService = :AuthService,
AuthData = :AuthData`
if len(email) != 0 {
if email != "" {
query += ", Email = lower(:Email)"
}