diff options
author | JoramWilander <jwawilander@gmail.com> | 2018-07-07 12:04:18 -0400 |
---|---|---|
committer | JoramWilander <jwawilander@gmail.com> | 2018-07-07 12:04:18 -0400 |
commit | b78b216a3c8eb354085f97f33dac5e7661ac9188 (patch) | |
tree | dc7a253730a684bc6744c0b0bf36a87944242583 /model/emoji.go | |
parent | 359f12db33d45b6ffade0872ddf3652a5c52f4a8 (diff) | |
parent | 9e5ec7d09d4c51e278f17f25fb6c0f3484b50a3b (diff) | |
download | chat-b78b216a3c8eb354085f97f33dac5e7661ac9188.tar.gz chat-b78b216a3c8eb354085f97f33dac5e7661ac9188.tar.bz2 chat-b78b216a3c8eb354085f97f33dac5e7661ac9188.zip |
Merge branch 'master' into plugins-2
Diffstat (limited to 'model/emoji.go')
-rw-r--r-- | model/emoji.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/model/emoji.go b/model/emoji.go index 78a266386..f14af89df 100644 --- a/model/emoji.go +++ b/model/emoji.go @@ -41,11 +41,15 @@ func (emoji *Emoji) IsValid() *AppError { return NewAppError("Emoji.IsValid", "model.emoji.update_at.app_error", nil, "id="+emoji.Id, http.StatusBadRequest) } - if len(emoji.CreatorId) != 26 { + if len(emoji.CreatorId) > 26 { return NewAppError("Emoji.IsValid", "model.emoji.user_id.app_error", nil, "", http.StatusBadRequest) } - if len(emoji.Name) == 0 || len(emoji.Name) > EMOJI_NAME_MAX_LENGTH || !IsValidAlphaNumHyphenUnderscore(emoji.Name, false) || inSystemEmoji(emoji.Name) { + return IsValidEmojiName(emoji.Name) +} + +func IsValidEmojiName(name string) *AppError { + if len(name) == 0 || len(name) > EMOJI_NAME_MAX_LENGTH || !IsValidAlphaNumHyphenUnderscore(name, false) || inSystemEmoji(name) { return NewAppError("Emoji.IsValid", "model.emoji.name.app_error", nil, "", http.StatusBadRequest) } |