Files
mattermost/app/brand.go
Chris 8e19ba029f Reduce utils.Cfg references (#7650)
* app.UpdateConfig method

* test fix

* another test fix

* the config override option as-was is just error prone, remove it for now

* derp
2017-10-18 15:36:43 -07:00

44 lines
1.2 KiB
Go

// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
package app
import (
"mime/multipart"
"net/http"
"github.com/mattermost/mattermost-server/model"
)
func (a *App) SaveBrandImage(imageData *multipart.FileHeader) *model.AppError {
if len(*a.Config().FileSettings.DriverName) == 0 {
return model.NewAppError("SaveBrandImage", "api.admin.upload_brand_image.storage.app_error", nil, "", http.StatusNotImplemented)
}
if a.Brand == nil {
return model.NewAppError("SaveBrandImage", "api.admin.upload_brand_image.not_available.app_error", nil, "", http.StatusNotImplemented)
}
if err := a.Brand.SaveBrandImage(imageData); err != nil {
return err
}
return nil
}
func (a *App) GetBrandImage() ([]byte, *model.AppError) {
if len(*a.Config().FileSettings.DriverName) == 0 {
return nil, model.NewAppError("GetBrandImage", "api.admin.get_brand_image.storage.app_error", nil, "", http.StatusNotImplemented)
}
if a.Brand == nil {
return nil, model.NewAppError("GetBrandImage", "api.admin.get_brand_image.not_available.app_error", nil, "", http.StatusNotImplemented)
}
if img, err := a.Brand.GetBrandImage(); err != nil {
return nil, err
} else {
return img, nil
}
}