summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/mattermost/mattermost-server/model/emoji.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2018-08-06 21:47:05 +0200
committerWim <wim@42.be>2018-08-06 21:47:05 +0200
commit51062863a5c34d81e296cf15c61140911037cf3b (patch)
tree9b5e044672486326c7a0ca8fb26430f37bf4d83c /vendor/github.com/mattermost/mattermost-server/model/emoji.go
parent4fb4b7aa6c02a54db8ad8dd98e4d321396926c0d (diff)
downloadmatterbridge-msglm-51062863a5c34d81e296cf15c61140911037cf3b.tar.gz
matterbridge-msglm-51062863a5c34d81e296cf15c61140911037cf3b.tar.bz2
matterbridge-msglm-51062863a5c34d81e296cf15c61140911037cf3b.zip
Use mod vendor for vendored directory (backwards compatible)
Diffstat (limited to 'vendor/github.com/mattermost/mattermost-server/model/emoji.go')
-rw-r--r--vendor/github.com/mattermost/mattermost-server/model/emoji.go83
1 files changed, 0 insertions, 83 deletions
diff --git a/vendor/github.com/mattermost/mattermost-server/model/emoji.go b/vendor/github.com/mattermost/mattermost-server/model/emoji.go
deleted file mode 100644
index a1703abb..00000000
--- a/vendor/github.com/mattermost/mattermost-server/model/emoji.go
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-package model
-
-import (
- "encoding/json"
- "io"
- "net/http"
-)
-
-const (
- EMOJI_NAME_MAX_LENGTH = 64
- EMOJI_SORT_BY_NAME = "name"
-)
-
-type Emoji struct {
- Id string `json:"id"`
- CreateAt int64 `json:"create_at"`
- UpdateAt int64 `json:"update_at"`
- DeleteAt int64 `json:"delete_at"`
- CreatorId string `json:"creator_id"`
- Name string `json:"name"`
-}
-
-func (emoji *Emoji) IsValid() *AppError {
- if len(emoji.Id) != 26 {
- return NewAppError("Emoji.IsValid", "model.emoji.id.app_error", nil, "", http.StatusBadRequest)
- }
-
- if emoji.CreateAt == 0 {
- return NewAppError("Emoji.IsValid", "model.emoji.create_at.app_error", nil, "id="+emoji.Id, http.StatusBadRequest)
- }
-
- if emoji.UpdateAt == 0 {
- return NewAppError("Emoji.IsValid", "model.emoji.update_at.app_error", nil, "id="+emoji.Id, http.StatusBadRequest)
- }
-
- 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) {
- return NewAppError("Emoji.IsValid", "model.emoji.name.app_error", nil, "", http.StatusBadRequest)
- }
-
- return nil
-}
-
-func (emoji *Emoji) PreSave() {
- if emoji.Id == "" {
- emoji.Id = NewId()
- }
-
- emoji.CreateAt = GetMillis()
- emoji.UpdateAt = emoji.CreateAt
-}
-
-func (emoji *Emoji) PreUpdate() {
- emoji.UpdateAt = GetMillis()
-}
-
-func (emoji *Emoji) ToJson() string {
- b, _ := json.Marshal(emoji)
- return string(b)
-}
-
-func EmojiFromJson(data io.Reader) *Emoji {
- var emoji *Emoji
- json.NewDecoder(data).Decode(&emoji)
- return emoji
-}
-
-func EmojiListToJson(emojiList []*Emoji) string {
- b, _ := json.Marshal(emojiList)
- return string(b)
-}
-
-func EmojiListFromJson(data io.Reader) []*Emoji {
- var emojiList []*Emoji
- json.NewDecoder(data).Decode(&emojiList)
- return emojiList
-}