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

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

@@ -123,7 +123,7 @@ func (a *App) SendNotifications(post *model.Post, team *model.Team, channel *mod
}
// get users that have comment thread mentions enabled
if len(post.RootId) > 0 && parentPostList != nil {
if post.RootId != "" && parentPostList != nil {
for _, threadPost := range parentPostList.Posts {
profile := profileMap[threadPost.UserId]
if profile != nil && (profile.NotifyProps[model.COMMENTS_NOTIFY_PROP] == model.COMMENTS_NOTIFY_ANY || (profile.NotifyProps[model.COMMENTS_NOTIFY_PROP] == model.COMMENTS_NOTIFY_ROOT && threadPost.Id == parentPostList.Order[0])) {
@@ -596,7 +596,7 @@ func makeOutOfChannelMentionPost(sender *model.User, post *model.Post, outOfChan
}
if len(outOfGroupsUsers) == 1 {
if len(message) > 0 {
if message != "" {
message += "\n"
}
@@ -606,7 +606,7 @@ func makeOutOfChannelMentionPost(sender *model.User, post *model.Post, outOfChan
} else if len(outOfGroupsUsers) > 1 {
preliminary, final := splitAtFinal(ogUsernames)
if len(message) > 0 {
if message != "" {
message += "\n"
}
@@ -1084,7 +1084,7 @@ func (m *ExplicitMentions) processText(text string, keywords map[string][]string
foundWithoutSuffix := false
wordWithoutSuffix := word
for len(wordWithoutSuffix) > 0 && strings.LastIndexAny(wordWithoutSuffix, ".-:_") == (len(wordWithoutSuffix)-1) {
for wordWithoutSuffix != "" && strings.LastIndexAny(wordWithoutSuffix, ".-:_") == (len(wordWithoutSuffix)-1) {
wordWithoutSuffix = wordWithoutSuffix[0 : len(wordWithoutSuffix)-1]
if m.checkForMention(wordWithoutSuffix, keywords, groups) {