Fix empty string comparison issues in the codebase (#16686)

Automatic Merge
Этот коммит содержится в:
Madhav Hugar
2021-01-25 11:15:17 +01:00
коммит произвёл GitHub
родитель 200a56fa5a
Коммит 94c24eea20
107 изменённых файлов: 368 добавлений и 368 удалений

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

@@ -77,7 +77,7 @@ func (s SqlWebhookStore) InvalidateWebhookCache(webhookId string) {
func (s SqlWebhookStore) SaveIncoming(webhook *model.IncomingWebhook) (*model.IncomingWebhook, error) {
if len(webhook.Id) > 0 {
if webhook.Id != "" {
return nil, store.NewErrInvalidInput("IncomingWebhook", "id", webhook.Id)
}
@@ -154,7 +154,7 @@ func (s SqlWebhookStore) GetIncomingListByUser(userId string, offset, limit int)
From("IncomingWebhooks").
Where(sq.Eq{"DeleteAt": int(0)}).Limit(uint64(limit)).Offset(uint64(offset))
if len(userId) > 0 {
if userId != "" {
query = query.Where(sq.Eq{"UserId": userId})
}
@@ -182,7 +182,7 @@ func (s SqlWebhookStore) GetIncomingByTeamByUser(teamId string, userId string, o
sq.Eq{"DeleteAt": int(0)},
}).Limit(uint64(limit)).Offset(uint64(offset))
if len(userId) > 0 {
if userId != "" {
query = query.Where(sq.Eq{"UserId": userId})
}
@@ -213,7 +213,7 @@ func (s SqlWebhookStore) GetIncomingByChannel(channelId string) ([]*model.Incomi
}
func (s SqlWebhookStore) SaveOutgoing(webhook *model.OutgoingWebhook) (*model.OutgoingWebhook, error) {
if len(webhook.Id) > 0 {
if webhook.Id != "" {
return nil, store.NewErrInvalidInput("OutgoingWebhook", "id", webhook.Id)
}
@@ -254,7 +254,7 @@ func (s SqlWebhookStore) GetOutgoingListByUser(userId string, offset, limit int)
sq.Eq{"DeleteAt": int(0)},
}).Limit(uint64(limit)).Offset(uint64(offset))
if len(userId) > 0 {
if userId != "" {
query = query.Where(sq.Eq{"CreatorId": userId})
}
@@ -286,7 +286,7 @@ func (s SqlWebhookStore) GetOutgoingByChannelByUser(channelId string, userId str
sq.Eq{"DeleteAt": int(0)},
})
if len(userId) > 0 {
if userId != "" {
query = query.Where(sq.Eq{"CreatorId": userId})
}
if limit >= 0 && offset >= 0 {
@@ -320,7 +320,7 @@ func (s SqlWebhookStore) GetOutgoingByTeamByUser(teamId string, userId string, o
sq.Eq{"DeleteAt": int(0)},
})
if len(userId) > 0 {
if userId != "" {
query = query.Where(sq.Eq{"CreatorId": userId})
}
if limit >= 0 && offset >= 0 {
@@ -391,7 +391,7 @@ func (s SqlWebhookStore) AnalyticsIncomingCount(teamId string) (int64, error) {
WHERE
DeleteAt = 0`
if len(teamId) > 0 {
if teamId != "" {
query += " AND TeamId = :TeamId"
}
@@ -412,7 +412,7 @@ func (s SqlWebhookStore) AnalyticsOutgoingCount(teamId string) (int64, error) {
WHERE
DeleteAt = 0`
if len(teamId) > 0 {
if teamId != "" {
query += " AND TeamId = :TeamId"
}