MM-31062: Rewrite empty string checks to be more idiomatic (#16587)
https://mattermost.atlassian.net/browse/MM-31062 ```release-note NONE ```
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
1a131b54af
Коммит
6487d0ca91
@@ -264,7 +264,7 @@ func (a *App) CreateWebhookPost(userId string, channel *model.Channel, text, ove
|
||||
}
|
||||
|
||||
if *a.Config().ServiceSettings.EnablePostUsernameOverride {
|
||||
if len(overrideUsername) != 0 {
|
||||
if overrideUsername != "" {
|
||||
post.AddProp("override_username", overrideUsername)
|
||||
} else {
|
||||
post.AddProp("override_username", model.DEFAULT_WEBHOOK_USERNAME)
|
||||
@@ -272,10 +272,10 @@ func (a *App) CreateWebhookPost(userId string, channel *model.Channel, text, ove
|
||||
}
|
||||
|
||||
if *a.Config().ServiceSettings.EnablePostIconOverride {
|
||||
if len(overrideIconUrl) != 0 {
|
||||
if overrideIconUrl != "" {
|
||||
post.AddProp("override_icon_url", overrideIconUrl)
|
||||
}
|
||||
if len(overrideIconEmoji) != 0 {
|
||||
if overrideIconEmoji != "" {
|
||||
post.AddProp("override_icon_emoji", overrideIconEmoji)
|
||||
}
|
||||
}
|
||||
@@ -445,7 +445,7 @@ func (a *App) CreateOutgoingWebhook(hook *model.OutgoingWebhook) (*model.Outgoin
|
||||
return nil, model.NewAppError("CreateOutgoingWebhook", "api.outgoing_webhook.disabled.app_error", nil, "", http.StatusNotImplemented)
|
||||
}
|
||||
|
||||
if len(hook.ChannelId) != 0 {
|
||||
if hook.ChannelId != "" {
|
||||
channel, errCh := a.Srv().Store.Channel().Get(hook.ChannelId, true)
|
||||
if errCh != nil {
|
||||
var nfErr *store.ErrNotFound
|
||||
@@ -696,7 +696,7 @@ func (a *App) HandleIncomingWebhook(hookId string, req *model.IncomingWebhookReq
|
||||
var channel *model.Channel
|
||||
var cchan chan store.StoreResult
|
||||
|
||||
if len(channelName) != 0 {
|
||||
if channelName != "" {
|
||||
if channelName[0] == '@' {
|
||||
result, nErr := a.Srv().Store.User().GetByUsername(channelName[1:])
|
||||
if nErr != nil {
|
||||
|
||||
Ссылка в новой задаче
Block a user