MM-31062: Rewrite empty string checks to be more idiomatic (#16587)
https://mattermost.atlassian.net/browse/MM-31062 ```release-note NONE ```
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
1a131b54af
Коммит
6487d0ca91
@@ -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)"
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user