From a08df883b4ddb514d53b518f41431ce7efb50d8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Espino?= Date: Thu, 20 Sep 2018 19:07:03 +0200 Subject: Move file backend to its own service (#9435) * Move file backend to its own service * Moving utils/inbucket to mailservice package --- app/admin.go | 3 ++- app/email.go | 3 ++- app/file.go | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) (limited to 'app') diff --git a/app/admin.go b/app/admin.go index 892e2d16b..940d85410 100644 --- a/app/admin.go +++ b/app/admin.go @@ -15,6 +15,7 @@ import ( "github.com/mattermost/mattermost-server/mlog" "github.com/mattermost/mattermost-server/model" + "github.com/mattermost/mattermost-server/services/mailservice" "github.com/mattermost/mattermost-server/utils" ) @@ -242,7 +243,7 @@ func (a *App) TestEmail(userId string, cfg *model.Config) *model.AppError { } else { T := utils.GetUserTranslations(user.Locale) license := a.License() - if err := utils.SendMailUsingConfig(user.Email, T("api.admin.test_email.subject"), T("api.admin.test_email.body"), cfg, license != nil && *license.Features.Compliance); err != nil { + if err := mailservice.SendMailUsingConfig(user.Email, T("api.admin.test_email.subject"), T("api.admin.test_email.body"), cfg, license != nil && *license.Features.Compliance); err != nil { return model.NewAppError("testEmail", "app.admin.test_email.failure", map[string]interface{}{"Error": err.Error()}, "", http.StatusInternalServerError) } } diff --git a/app/email.go b/app/email.go index 8d6535e2b..eefe83a81 100644 --- a/app/email.go +++ b/app/email.go @@ -16,6 +16,7 @@ import ( "github.com/mattermost/mattermost-server/mlog" "github.com/mattermost/mattermost-server/model" + "github.com/mattermost/mattermost-server/services/mailservice" "github.com/mattermost/mattermost-server/utils" ) @@ -402,5 +403,5 @@ func (a *App) SendDeactivateAccountEmail(email string, locale, siteURL string) * func (a *App) SendMail(to, subject, htmlBody string) *model.AppError { license := a.License() - return utils.SendMailUsingConfig(to, subject, htmlBody, a.Config(), license != nil && *license.Features.Compliance) + return mailservice.SendMailUsingConfig(to, subject, htmlBody, a.Config(), license != nil && *license.Features.Compliance) } diff --git a/app/file.go b/app/file.go index 278990b49..5dfc23bd8 100644 --- a/app/file.go +++ b/app/file.go @@ -29,6 +29,7 @@ import ( "github.com/mattermost/mattermost-server/mlog" "github.com/mattermost/mattermost-server/model" "github.com/mattermost/mattermost-server/plugin" + "github.com/mattermost/mattermost-server/services/filesstore" "github.com/mattermost/mattermost-server/utils" ) @@ -58,9 +59,9 @@ const ( IMAGE_PREVIEW_PIXEL_WIDTH = 1920 ) -func (a *App) FileBackend() (utils.FileBackend, *model.AppError) { +func (a *App) FileBackend() (filesstore.FileBackend, *model.AppError) { license := a.License() - return utils.NewFileBackend(&a.Config().FileSettings, license != nil && *license.Features.Compliance) + return filesstore.NewFileBackend(&a.Config().FileSettings, license != nil && *license.Features.Compliance) } func (a *App) ReadFile(path string) ([]byte, *model.AppError) { -- cgit v1.2.3-1-g7c22