Removing all FakeApp usages (#14174)
* Removing some other fake apps * More FakeApp removed * Removing entirely FakeApp * Fixing some tests * Fixing get Cluster id from get plugin status * Fixing failing tests * Fixing tests * Fixing test initialization for web * Fixing InitServer for server tests * Fixing InitServer for server tests * Reverting go.sum and go.mod * Removing unneded HTMLTemplates function in App layer * Moving back some functions to its old place to easy the review * Moving back some functions to its old place to easy the review * Using the last struct2interface version * Generating store layers * Fixing merge problems * Addressing PR comments * Small fix * Fixing app tests build * Fixing tests * fixing tests * Fix tests * Fixing tests * Fixing tests * Fixing tests * Moving license to server struct * Adding some fixes to the test compilation * Fixing cluster and some jobs initialization * Fixing some license tests compilation problems * Fixing recursive cache invalidation * Regenerating app layers * Fix test compilation Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
f3ac33e6dc
Коммит
f5eab1271b
48
app/email.go
48
app/email.go
@@ -39,7 +39,7 @@ func condenseSiteURL(siteURL string) string {
|
||||
return path.Join(parsedSiteURL.Host, parsedSiteURL.Path)
|
||||
}
|
||||
|
||||
func (a *App) SetupInviteEmailRateLimiting() error {
|
||||
func (s *Server) setupInviteEmailRateLimiting() error {
|
||||
store, err := memstore.New(emailRateLimitingMemstoreSize)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "Unable to setup email rate limiting memstore.")
|
||||
@@ -55,7 +55,7 @@ func (a *App) SetupInviteEmailRateLimiting() error {
|
||||
return errors.Wrap(err, "Unable to setup email rate limiting GCRA rate limiter.")
|
||||
}
|
||||
|
||||
a.Srv().EmailRateLimiter = rateLimiter
|
||||
s.EmailRateLimiter = rateLimiter
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -463,8 +463,8 @@ func (a *App) sendGuestInviteEmails(team *model.Team, channels []*model.Channel,
|
||||
}
|
||||
}
|
||||
|
||||
func (a *App) newEmailTemplate(name, locale string) *utils.HTMLTemplate {
|
||||
t := utils.NewHTMLTemplate(a.HTMLTemplates(), name)
|
||||
func (s *Server) newEmailTemplate(name, locale string) *utils.HTMLTemplate {
|
||||
t := utils.NewHTMLTemplate(s.HTMLTemplates(), name)
|
||||
|
||||
var localT i18n.TranslateFunc
|
||||
if locale != "" {
|
||||
@@ -475,8 +475,8 @@ func (a *App) newEmailTemplate(name, locale string) *utils.HTMLTemplate {
|
||||
|
||||
t.Props["Footer"] = localT("api.templates.email_footer")
|
||||
|
||||
if *a.Config().EmailSettings.FeedbackOrganization != "" {
|
||||
t.Props["Organization"] = localT("api.templates.email_organization") + *a.Config().EmailSettings.FeedbackOrganization
|
||||
if *s.Config().EmailSettings.FeedbackOrganization != "" {
|
||||
t.Props["Organization"] = localT("api.templates.email_organization") + *s.Config().EmailSettings.FeedbackOrganization
|
||||
} else {
|
||||
t.Props["Organization"] = ""
|
||||
}
|
||||
@@ -484,12 +484,16 @@ func (a *App) newEmailTemplate(name, locale string) *utils.HTMLTemplate {
|
||||
t.Props["EmailInfo1"] = localT("api.templates.email_info1")
|
||||
t.Props["EmailInfo2"] = localT("api.templates.email_info2")
|
||||
t.Props["EmailInfo3"] = localT("api.templates.email_info3",
|
||||
map[string]interface{}{"SiteName": a.Config().TeamSettings.SiteName})
|
||||
t.Props["SupportEmail"] = *a.Config().SupportSettings.SupportEmail
|
||||
map[string]interface{}{"SiteName": s.Config().TeamSettings.SiteName})
|
||||
t.Props["SupportEmail"] = *s.Config().SupportSettings.SupportEmail
|
||||
|
||||
return t
|
||||
}
|
||||
|
||||
func (a *App) newEmailTemplate(name, locale string) *utils.HTMLTemplate {
|
||||
return a.Srv().newEmailTemplate(name, locale)
|
||||
}
|
||||
|
||||
func (a *App) SendDeactivateAccountEmail(email string, locale, siteURL string) *model.AppError {
|
||||
T := utils.GetUserTranslations(locale)
|
||||
|
||||
@@ -531,21 +535,33 @@ func (a *App) SendRemoveExpiredLicenseEmail(email string, locale, siteURL string
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *App) sendNotificationMail(to, subject, htmlBody string) *model.AppError {
|
||||
if !*a.Config().EmailSettings.SendEmailNotifications {
|
||||
func (s *Server) sendNotificationMail(to, subject, htmlBody string) *model.AppError {
|
||||
if !*s.Config().EmailSettings.SendEmailNotifications {
|
||||
return nil
|
||||
}
|
||||
return a.sendMail(to, subject, htmlBody)
|
||||
return s.sendMail(to, subject, htmlBody)
|
||||
}
|
||||
|
||||
func (a *App) sendNotificationMail(to, subject, htmlBody string) *model.AppError {
|
||||
return a.Srv().sendNotificationMail(to, subject, htmlBody)
|
||||
}
|
||||
|
||||
func (s *Server) sendMail(to, subject, htmlBody string) *model.AppError {
|
||||
license := s.License()
|
||||
return mailservice.SendMailUsingConfig(to, subject, htmlBody, s.Config(), license != nil && *license.Features.Compliance)
|
||||
}
|
||||
|
||||
func (a *App) sendMail(to, subject, htmlBody string) *model.AppError {
|
||||
license := a.License()
|
||||
return mailservice.SendMailUsingConfig(to, subject, htmlBody, a.Config(), license != nil && *license.Features.Compliance)
|
||||
return a.Srv().sendMail(to, subject, htmlBody)
|
||||
}
|
||||
|
||||
func (a *App) sendMailWithEmbeddedFiles(to, subject, htmlBody string, embeddedFiles map[string]io.Reader) *model.AppError {
|
||||
license := a.License()
|
||||
config := a.Config()
|
||||
func (s *Server) sendMailWithEmbeddedFiles(to, subject, htmlBody string, embeddedFiles map[string]io.Reader) *model.AppError {
|
||||
license := s.License()
|
||||
config := s.Config()
|
||||
|
||||
return mailservice.SendMailWithEmbeddedFilesUsingConfig(to, subject, htmlBody, embeddedFiles, config, license != nil && *license.Features.Compliance)
|
||||
}
|
||||
|
||||
func (a *App) sendMailWithEmbeddedFiles(to, subject, htmlBody string, embeddedFiles map[string]io.Reader) *model.AppError {
|
||||
return a.Srv().sendMailWithEmbeddedFiles(to, subject, htmlBody, embeddedFiles)
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user