Add SetProfileImage for plugin API (#9831)

Этот коммит содержится в:
Carlos Tadeu Panato Junior
2018-11-15 21:23:03 +01:00
коммит произвёл Hanzei
родитель f0351f23f1
Коммит b29f1cb844
7 изменённых файлов: 136 добавлений и 34 удалений

Просмотреть файл

@@ -4,6 +4,7 @@
package app
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
@@ -389,6 +390,20 @@ func (api *PluginAPI) GetProfileImage(userId string) ([]byte, *model.AppError) {
return data, err
}
func (api *PluginAPI) SetProfileImage(userId string, data []byte) *model.AppError {
_, err := api.app.GetUser(userId)
if err != nil {
return err
}
fileReader := bytes.NewReader(data)
err = api.app.SetProfileImageFromFile(userId, fileReader)
if err != nil {
return err
}
return nil
}
func (api *PluginAPI) GetEmojiList(sortBy string, page, perPage int) ([]*model.Emoji, *model.AppError) {
return api.app.GetEmojiList(page, perPage, sortBy)
}