diff options
author | George Goldberg <george@gberg.me> | 2018-02-06 17:25:53 +0000 |
---|---|---|
committer | George Goldberg <george@gberg.me> | 2018-02-06 17:25:53 +0000 |
commit | 7941c30117efe1b957ac0458c2f0479e3824196d (patch) | |
tree | df791632a9dc790a6f73dec53aae3ba919ebda63 /model/emoji.go | |
parent | e1cd64613591cf5a990442a69ebf188258bd0cb5 (diff) | |
parent | 034dbc07e3068c482e654b6a1a8fcbe4b01c44f3 (diff) | |
download | chat-7941c30117efe1b957ac0458c2f0479e3824196d.tar.gz chat-7941c30117efe1b957ac0458c2f0479e3824196d.tar.bz2 chat-7941c30117efe1b957ac0458c2f0479e3824196d.zip |
Merge branch 'master' into advanced-permissions-phase-1
Diffstat (limited to 'model/emoji.go')
-rw-r--r-- | model/emoji.go | 36 |
1 files changed, 9 insertions, 27 deletions
diff --git a/model/emoji.go b/model/emoji.go index 3deff4c5f..a1703abb1 100644 --- a/model/emoji.go +++ b/model/emoji.go @@ -61,41 +61,23 @@ func (emoji *Emoji) PreUpdate() { } func (emoji *Emoji) ToJson() string { - b, err := json.Marshal(emoji) - if err != nil { - return "" - } else { - return string(b) - } + b, _ := json.Marshal(emoji) + return string(b) } func EmojiFromJson(data io.Reader) *Emoji { - decoder := json.NewDecoder(data) - var emoji Emoji - err := decoder.Decode(&emoji) - if err == nil { - return &emoji - } else { - return nil - } + var emoji *Emoji + json.NewDecoder(data).Decode(&emoji) + return emoji } func EmojiListToJson(emojiList []*Emoji) string { - b, err := json.Marshal(emojiList) - if err != nil { - return "" - } else { - return string(b) - } + b, _ := json.Marshal(emojiList) + return string(b) } func EmojiListFromJson(data io.Reader) []*Emoji { - decoder := json.NewDecoder(data) var emojiList []*Emoji - err := decoder.Decode(&emojiList) - if err == nil { - return emojiList - } else { - return nil - } + json.NewDecoder(data).Decode(&emojiList) + return emojiList } |