forked from mattermost/mattermost
-
Notifications
You must be signed in to change notification settings - Fork 0
/
brand.go
43 lines (33 loc) · 1.22 KB
/
brand.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// 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
}
}