summaryrefslogtreecommitdiffstats
path: root/app/brand.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-03-14 09:35:48 -0400
committerGitHub <noreply@github.com>2017-03-14 09:35:48 -0400
commitad0ed008fe54534fcc089f479df606ab921901a9 (patch)
treea5fda084fb7ea61941449b393a6084f0c049195c /app/brand.go
parentd03367c56005470396d883d273323ecbd8d4f243 (diff)
downloadchat-ad0ed008fe54534fcc089f479df606ab921901a9.tar.gz
chat-ad0ed008fe54534fcc089f479df606ab921901a9.tar.bz2
chat-ad0ed008fe54534fcc089f479df606ab921901a9.zip
Implement brand image endpoints for APIv4 (#5733)
* Implement brand image endpoints for APIv4 * Fix unit test
Diffstat (limited to 'app/brand.go')
-rw-r--r--app/brand.go16
1 files changed, 7 insertions, 9 deletions
diff --git a/app/brand.go b/app/brand.go
index aeecc6972..9b3df3145 100644
--- a/app/brand.go
+++ b/app/brand.go
@@ -13,11 +13,13 @@ import (
)
func SaveBrandImage(imageData *multipart.FileHeader) *model.AppError {
+ if len(utils.Cfg.FileSettings.DriverName) == 0 {
+ return model.NewAppError("SaveBrandImage", "api.admin.upload_brand_image.storage.app_error", nil, "", http.StatusNotImplemented)
+ }
+
brandInterface := einterfaces.GetBrandInterface()
if brandInterface == nil {
- err := model.NewLocAppError("SaveBrandImage", "api.admin.upload_brand_image.not_available.app_error", nil, "")
- err.StatusCode = http.StatusNotImplemented
- return err
+ return model.NewAppError("SaveBrandImage", "api.admin.upload_brand_image.not_available.app_error", nil, "", http.StatusNotImplemented)
}
if err := brandInterface.SaveBrandImage(imageData); err != nil {
@@ -29,16 +31,12 @@ func SaveBrandImage(imageData *multipart.FileHeader) *model.AppError {
func GetBrandImage() ([]byte, *model.AppError) {
if len(utils.Cfg.FileSettings.DriverName) == 0 {
- err := model.NewLocAppError("GetBrandImage", "api.admin.get_brand_image.storage.app_error", nil, "")
- err.StatusCode = http.StatusNotImplemented
- return nil, err
+ return nil, model.NewAppError("GetBrandImage", "api.admin.get_brand_image.storage.app_error", nil, "", http.StatusNotImplemented)
}
brandInterface := einterfaces.GetBrandInterface()
if brandInterface == nil {
- err := model.NewLocAppError("GetBrandImage", "api.admin.get_brand_image.not_available.app_error", nil, "")
- err.StatusCode = http.StatusNotImplemented
- return nil, err
+ return nil, model.NewAppError("GetBrandImage", "api.admin.get_brand_image.not_available.app_error", nil, "", http.StatusNotImplemented)
}
if img, err := brandInterface.GetBrandImage(); err != nil {