Add GET /emojis/name/{emoji_name} API endpoint (#8142)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
f2415b98f6
Коммит
3918ed6c58
16
app/emoji.go
16
app/emoji.go
@@ -148,6 +148,22 @@ func (a *App) GetEmoji(emojiId string) (*model.Emoji, *model.AppError) {
|
||||
}
|
||||
}
|
||||
|
||||
func (a *App) GetEmojiByName(emojiName string) (*model.Emoji, *model.AppError) {
|
||||
if !*a.Config().ServiceSettings.EnableCustomEmoji {
|
||||
return nil, model.NewAppError("GetEmoji", "api.emoji.disabled.app_error", nil, "", http.StatusNotImplemented)
|
||||
}
|
||||
|
||||
if len(*a.Config().FileSettings.DriverName) == 0 {
|
||||
return nil, model.NewAppError("GetEmoji", "api.emoji.storage.app_error", nil, "", http.StatusNotImplemented)
|
||||
}
|
||||
|
||||
if result := <-a.Srv.Store.Emoji().GetByName(emojiName); result.Err != nil {
|
||||
return nil, result.Err
|
||||
} else {
|
||||
return result.Data.(*model.Emoji), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (a *App) GetEmojiImage(emojiId string) (imageByte []byte, imageType string, err *model.AppError) {
|
||||
if result := <-a.Srv.Store.Emoji().Get(emojiId, true); result.Err != nil {
|
||||
return nil, "", result.Err
|
||||
|
||||
Ссылка в новой задаче
Block a user