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

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

@@ -520,7 +520,7 @@ func (a *App) DoCommandRequest(cmd *model.Command, p url.Values) (*model.Command
func (a *App) HandleCommandResponse(command *model.Command, args *model.CommandArgs, response *model.CommandResponse, builtIn bool) (*model.CommandResponse, *model.AppError) {
trigger := ""
if len(args.Command) != 0 {
if args.Command != "" {
parts := strings.Split(args.Command, " ")
trigger = parts[0][1:]
trigger = strings.ToLower(trigger)
@@ -561,7 +561,7 @@ func (a *App) HandleCommandResponsePost(command *model.Command, args *model.Comm
post.Type = response.Type
post.SetProps(response.Props)
if len(response.ChannelId) != 0 {
if response.ChannelId != "" {
_, err := a.GetChannelMember(response.ChannelId, args.UserId)
if err != nil {
err = model.NewAppError("HandleCommandResponsePost", "api.command.command_post.forbidden.app_error", nil, err.Error(), http.StatusForbidden)
@@ -573,20 +573,20 @@ func (a *App) HandleCommandResponsePost(command *model.Command, args *model.Comm
isBotPost := !builtIn
if *a.Config().ServiceSettings.EnablePostUsernameOverride {
if len(command.Username) != 0 {
if command.Username != "" {
post.AddProp("override_username", command.Username)
isBotPost = true
} else if len(response.Username) != 0 {
} else if response.Username != "" {
post.AddProp("override_username", response.Username)
isBotPost = true
}
}
if *a.Config().ServiceSettings.EnablePostIconOverride {
if len(command.IconURL) != 0 {
if command.IconURL != "" {
post.AddProp("override_icon_url", command.IconURL)
isBotPost = true
} else if len(response.IconURL) != 0 {
} else if response.IconURL != "" {
post.AddProp("override_icon_url", response.IconURL)
isBotPost = true
} else {