From b3c2ecd9b9209413e7272b2fcd7bd3d04f2f85f4 Mon Sep 17 00:00:00 2001 From: Pradeep Murugesan Date: Wed, 25 Jul 2018 14:31:41 +0200 Subject: 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 --- model/outgoing_webhook.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'model/outgoing_webhook.go') 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 } -- cgit v1.2.3-1-g7c22