summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJulien Levesy <jlevesy@gmail.com>2018-10-15 16:46:26 +0200
committerGeorge Goldberg <george@gberg.me>2018-10-15 15:46:26 +0100
commit43bdbb0c3a0d93a8bf34ae5e2abbad4586a2581b (patch)
treeaeca7af5d638e22c9e425f352494a1b17d72d83d /app
parent160d2785927d4729441dfa6ecd0d5536ec640687 (diff)
downloadchat-43bdbb0c3a0d93a8bf34ae5e2abbad4586a2581b.tar.gz
chat-43bdbb0c3a0d93a8bf34ae5e2abbad4586a2581b.tar.bz2
chat-43bdbb0c3a0d93a8bf34ae5e2abbad4586a2581b.zip
Add a delete brand image action on the APIv4 (#9552)
Diffstat (limited to 'app')
-rw-r--r--app/brand.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/brand.go b/app/brand.go
index a2feac7ec..6c1091fff 100644
--- a/app/brand.go
+++ b/app/brand.go
@@ -77,3 +77,19 @@ func (a *App) GetBrandImage() ([]byte, *model.AppError) {
return img, nil
}
+
+func (a *App) DeleteBrandImage() *model.AppError {
+ filePath := BRAND_FILE_PATH + BRAND_FILE_NAME
+
+ fileExists, err := a.FileExists(filePath)
+
+ if err != nil {
+ return err
+ }
+
+ if !fileExists {
+ return model.NewAppError("DeleteBrandImage", "api.admin.delete_brand_image.storage.not_found", nil, "", http.StatusNotFound)
+ }
+
+ return a.RemoveFile(filePath)
+}