diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2016-04-11 09:04:56 -0400 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2016-04-11 09:04:56 -0400 |
commit | 29e1a853601514284c2af3f3302f30ad0d3c6d54 (patch) | |
tree | f06e39d3fc31684359888657512b13e2b7719277 /model/outgoing_webhook.go | |
parent | 81e7e853697263f25ca505cc9b2cd50c6e2fe739 (diff) | |
download | chat-29e1a853601514284c2af3f3302f30ad0d3c6d54.tar.gz chat-29e1a853601514284c2af3f3302f30ad0d3c6d54.tar.bz2 chat-29e1a853601514284c2af3f3302f30ad0d3c6d54.zip |
PLT-2553 Additional backstage UI Improvements (#2673)
* Renamed Commands to Slash Commands in backstage UI
* Updated displayed info for listed commands and outgoing webhooks
* Disallowed empty outgoing webhook trigger words and improved client-side validation for them
Diffstat (limited to 'model/outgoing_webhook.go')
-rw-r--r-- | model/outgoing_webhook.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/model/outgoing_webhook.go b/model/outgoing_webhook.go index e13de9080..ef1807e7a 100644 --- a/model/outgoing_webhook.go +++ b/model/outgoing_webhook.go @@ -98,6 +98,14 @@ func (o *OutgoingWebhook) IsValid() *AppError { return NewLocAppError("OutgoingWebhook.IsValid", "model.outgoing_hook.is_valid.words.app_error", nil, "") } + if len(o.TriggerWords) != 0 { + for _, triggerWord := range o.TriggerWords { + if len(triggerWord) == 0 { + return NewLocAppError("OutgoingWebhook.IsValid", "model.outgoing_hook.is_valid.trigger_words.app_error", nil, "") + } + } + } + if len(o.CallbackURLs) == 0 || len(fmt.Sprintf("%s", o.CallbackURLs)) > 1024 { return NewLocAppError("OutgoingWebhook.IsValid", "model.outgoing_hook.is_valid.callback.app_error", nil, "") } |