diff options
author | Pradeep Murugesan <pradeepmurugesan@outlook.com> | 2018-07-25 14:31:41 +0200 |
---|---|---|
committer | Jesse Hallam <jesse.hallam@gmail.com> | 2018-07-25 08:31:41 -0400 |
commit | b3c2ecd9b9209413e7272b2fcd7bd3d04f2f85f4 (patch) | |
tree | 6c4ebe9d5bd20b2923e85b0586c7929682d392c5 /model/outgoing_webhook.go | |
parent | b89ccca929e67ddd2a8f7ac2e952532bf615a51b (diff) | |
download | chat-b3c2ecd9b9209413e7272b2fcd7bd3d04f2f85f4.tar.gz chat-b3c2ecd9b9209413e7272b2fcd7bd3d04f2f85f4.tar.bz2 chat-b3c2ecd9b9209413e7272b2fcd7bd3d04f2f85f4.zip |
added the custom icon and username for the outgoing webhook and its response (#9141)
* 8272 added the username and icon as part of the model and persisted the same
* 8272 added the custome icon and name when set to the web hook response
* 8272 changed the infinte loop to timeout after 5 seconds
* 8272 fixed review comments
Diffstat (limited to 'model/outgoing_webhook.go')
-rw-r--r-- | model/outgoing_webhook.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/model/outgoing_webhook.go b/model/outgoing_webhook.go index b5dbf34d9..698a226e3 100644 --- a/model/outgoing_webhook.go +++ b/model/outgoing_webhook.go @@ -28,6 +28,8 @@ type OutgoingWebhook struct { DisplayName string `json:"display_name"` Description string `json:"description"` ContentType string `json:"content_type"` + Username string `json:"username"` + IconURL string `json:"icon_url"` } type OutgoingWebhookPayload struct { @@ -181,6 +183,14 @@ func (o *OutgoingWebhook) IsValid() *AppError { return NewAppError("OutgoingWebhook.IsValid", "model.outgoing_hook.is_valid.content_type.app_error", nil, "", http.StatusBadRequest) } + if len(o.Username) > 64 { + return NewAppError("OutgoingWebhook.IsValid", "model.outgoing_hook.username.app_error", nil, "", http.StatusBadRequest) + } + + if len(o.IconURL) > 1024 { + return NewAppError("OutgoingWebhook.IsValid", "model.outgoing_hook.icon_url.app_error", nil, "", http.StatusBadRequest) + } + return nil } |