summaryrefslogtreecommitdiffstats
path: root/model/incoming_webhook.go
diff options
context:
space:
mode:
authorJesse Hallam <jesse.hallam@gmail.com>2018-01-02 11:41:23 -0500
committerChristopher Speller <crspeller@gmail.com>2018-01-02 08:41:23 -0800
commite9fe9f50dd5839a7cf0926a2d97e88a19c9b831e (patch)
tree87073ea7310a356b4f2d78a5b5f569730ef89257 /model/incoming_webhook.go
parentb902e4eea9732573d3a3dc9f6a62ca7029cac409 (diff)
downloadchat-e9fe9f50dd5839a7cf0926a2d97e88a19c9b831e.tar.gz
chat-e9fe9f50dd5839a7cf0926a2d97e88a19c9b831e.tar.bz2
chat-e9fe9f50dd5839a7cf0926a2d97e88a19c9b831e.zip
[PLT-8173] Add username and profile picture to webhook set up pages (#8002)
Diffstat (limited to 'model/incoming_webhook.go')
-rw-r--r--model/incoming_webhook.go28
1 files changed, 19 insertions, 9 deletions
diff --git a/model/incoming_webhook.go b/model/incoming_webhook.go
index e9468e87b..2eb007340 100644
--- a/model/incoming_webhook.go
+++ b/model/incoming_webhook.go
@@ -16,15 +16,17 @@ const (
)
type IncomingWebhook struct {
- Id string `json:"id"`
- CreateAt int64 `json:"create_at"`
- UpdateAt int64 `json:"update_at"`
- DeleteAt int64 `json:"delete_at"`
- UserId string `json:"user_id"`
- ChannelId string `json:"channel_id"`
- TeamId string `json:"team_id"`
- DisplayName string `json:"display_name"`
- Description string `json:"description"`
+ Id string `json:"id"`
+ CreateAt int64 `json:"create_at"`
+ UpdateAt int64 `json:"update_at"`
+ DeleteAt int64 `json:"delete_at"`
+ UserId string `json:"user_id"`
+ ChannelId string `json:"channel_id"`
+ TeamId string `json:"team_id"`
+ DisplayName string `json:"display_name"`
+ Description string `json:"description"`
+ PostUsername string `json:"post_username"`
+ PostIconURL string `json:"post_icon_url"`
}
type IncomingWebhookRequest struct {
@@ -112,6 +114,14 @@ func (o *IncomingWebhook) IsValid() *AppError {
return NewAppError("IncomingWebhook.IsValid", "model.incoming_hook.description.app_error", nil, "", http.StatusBadRequest)
}
+ if len(o.PostUsername) > 64 {
+ return NewAppError("IncomingWebhook.IsValid", "model.incoming_hook.username.app_error", nil, "", http.StatusBadRequest)
+ }
+
+ if len(o.PostIconURL) > 1024 {
+ return NewAppError("IncomingWebhook.IsValid", "model.incoming_hook.post_icon_url.app_error", nil, "", http.StatusBadRequest)
+ }
+
return nil
}