summaryrefslogtreecommitdiffstats
path: root/model/emoji.go
diff options
context:
space:
mode:
authorJesús Espino <jespinog@gmail.com>2018-01-11 16:57:47 +0100
committerJoram Wilander <jwawilander@gmail.com>2018-01-11 10:57:47 -0500
commit6990d052d5e95295e729aae28a0d30bfdcb98573 (patch)
treedc441fdd959997f97cfff298c833a2503cee4a37 /model/emoji.go
parent0a9200c35d4f3c5c0462135f5f6dfe60bfe364e8 (diff)
downloadchat-6990d052d5e95295e729aae28a0d30bfdcb98573.tar.gz
chat-6990d052d5e95295e729aae28a0d30bfdcb98573.tar.bz2
chat-6990d052d5e95295e729aae28a0d30bfdcb98573.zip
[XYZ-6] Add sampledata platform command (#8027)
* Add fake dependency * [XYZ-6] Add sampledata platform command * Creating EMOJI_NAME_MAX_LENGTH as a constant and using it where needed
Diffstat (limited to 'model/emoji.go')
-rw-r--r--model/emoji.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/model/emoji.go b/model/emoji.go
index 272616d90..784fe832b 100644
--- a/model/emoji.go
+++ b/model/emoji.go
@@ -9,6 +9,10 @@ import (
"net/http"
)
+const (
+ EMOJI_NAME_MAX_LENGTH = 64
+)
+
type Emoji struct {
Id string `json:"id"`
CreateAt int64 `json:"create_at"`
@@ -35,7 +39,7 @@ func (emoji *Emoji) IsValid() *AppError {
return NewAppError("Emoji.IsValid", "model.emoji.user_id.app_error", nil, "", http.StatusBadRequest)
}
- if len(emoji.Name) == 0 || len(emoji.Name) > 64 || !IsValidAlphaNumHyphenUnderscore(emoji.Name, false) {
+ if len(emoji.Name) == 0 || len(emoji.Name) > EMOJI_NAME_MAX_LENGTH || !IsValidAlphaNumHyphenUnderscore(emoji.Name, false) {
return NewAppError("Emoji.IsValid", "model.emoji.name.app_error", nil, "", http.StatusBadRequest)
}