Reduce the coupling of the mailservice with the rest of the application (#16898)

* Reduce the coupling of the mailservice with the rest of the application

* Fixing tests in CI

* Simplifiying mailservice config

* Addressing PR review comments

* Fixing tests

* Removing unnecesary type definition

* Fixing ServerName usage
Этот коммит содержится в:
Jesús Espino
2021-02-16 12:42:03 +01:00
коммит произвёл GitHub
родитель 69ff686667
Коммит d06a62ce64
8 изменённых файлов: 160 добавлений и 242 удалений

Просмотреть файл

@@ -497,7 +497,8 @@ func (a *App) NotifyAndSetWarnMetricAck(warnMetricId string, sender *model.User,
subject := T("api.templates.warn_metric_ack.subject")
bodyPage.Props["Title"] = warnMetricDisplayTexts.EmailBody
if err := mailservice.SendMailUsingConfig(model.MM_SUPPORT_ADVISOR_ADDRESS, subject, bodyPage.Render(), a.Config(), false, sender.Email); err != nil {
mailConfig := a.Srv().MailServiceConfig()
if err := mailservice.SendMailUsingConfig(model.MM_SUPPORT_ADVISOR_ADDRESS, subject, bodyPage.Render(), mailConfig, false, sender.Email); err != nil {
return model.NewAppError("NotifyAndSetWarnMetricAck", "api.email.send_warn_metric_ack.failure.app_error", map[string]interface{}{"Error": err.Error()}, "", http.StatusInternalServerError)
}
}