Add SetProfileImage for plugin API (#9831)
Этот коммит содержится в:
коммит произвёл
Hanzei
родитель
f0351f23f1
Коммит
b29f1cb844
@@ -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)
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user