[MM-40917] - Inactive Server Email Notification (#19374)
* [MM-40917] - Inactive Server Email Notification * add email template * make store layers * add some store tests * fix translations * fix logic * improve * fix lint * feedback-impl * fix wrong text * optimize queries * move feature flag check * feedback impl-1 * add line * feedback impl Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
1b1ba687bb
Коммит
8d6d1c51c2
@@ -762,6 +762,39 @@ func (es *Service) SendAtUserLimitWarningEmail(email string, locale string, site
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func (es *Service) SendLicenseInactivityEmail(email, name, locale, siteURL string) error {
|
||||
T := i18n.GetUserTranslations(locale)
|
||||
subject := T("api.templates.server_inactivity_subject")
|
||||
data := es.NewEmailTemplateData(locale)
|
||||
data.Props["SiteURL"] = siteURL
|
||||
data.Props["Title"] = T("api.templates.server_inactivity_title")
|
||||
data.Props["SubTitle"] = T("api.templates.server_inactivity_subtitle", map[string]interface{}{"Name": name})
|
||||
data.Props["InfoBullet"] = T("api.templates.server_inactivity_info_bullet")
|
||||
data.Props["InfoBullet1"] = T("api.templates.server_inactivity_info_bullet1")
|
||||
data.Props["InfoBullet2"] = T("api.templates.server_inactivity_info_bullet2")
|
||||
data.Props["Info"] = T("api.templates.server_inactivity_info")
|
||||
data.Props["EmailUs"] = T("api.templates.email_us_anytime_at")
|
||||
data.Props["QuestionTitle"] = T("api.templates.questions_footer.title")
|
||||
data.Props["QuestionInfo"] = T("api.templates.questions_footer.info")
|
||||
data.Props["Button"] = T("api.templates.server_inactivity_button")
|
||||
data.Props["SupportEmail"] = "feedback@mattermost.com"
|
||||
data.Props["ButtonURL"] = siteURL
|
||||
data.Props["Channels"] = T("Channels")
|
||||
data.Props["Playbooks"] = T("Playbooks")
|
||||
data.Props["Boards"] = T("Boards")
|
||||
|
||||
body, err := es.templatesContainer.RenderToString("inactivity_body", data)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := es.sendMail(email, subject, body); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (es *Service) SendLicenseUpForRenewalEmail(email, name, locale, siteURL, renewalLink string, daysToExpiration int) error {
|
||||
T := i18n.GetUserTranslations(locale)
|
||||
subject := T("api.templates.license_up_for_renewal_subject")
|
||||
@@ -775,6 +808,7 @@ func (es *Service) SendLicenseUpForRenewalEmail(email, name, locale, siteURL, re
|
||||
data.Props["Button"] = T("api.templates.license_up_for_renewal_renew_now")
|
||||
data.Props["ButtonURL"] = renewalLink
|
||||
data.Props["QuestionTitle"] = T("api.templates.questions_footer.title")
|
||||
data.Props["SupportEmail"] = "feedback@mattermost.com"
|
||||
data.Props["QuestionInfo"] = T("api.templates.questions_footer.info")
|
||||
|
||||
body, err := es.templatesContainer.RenderToString("license_up_for_renewal", data)
|
||||
|
||||
Ссылка в новой задаче
Block a user