Break HTML blocks to individual strings (#8903)

* Modifying message and templates about mfa_change

* Modifying message and templates about password_change

* Modify message and template about password_reset

* Modify message and template about singin_change

* Modify message and template about email_info

* Modify message and template about change_username

* Modify message about change_email

* Add missing props

* Add argument

* Modify message and template about token_added

* Modify messages and template about notification_email

* Modify message and template about deactivate_email

* Fix style

* Remove unused message

* Remove br tags

* Modify message and code about invite_mail

* Add missing message
Этот коммит содержится в:
Yusuke Nemoto
2018-07-21 01:52:20 +09:00
коммит произвёл Elias Nahum
родитель 908a682fcf
Коммит 6104c37761
15 изменённых файлов: 120 добавлений и 73 удалений

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

@@ -6,7 +6,6 @@ package app
import (
"fmt"
"html"
"html/template"
"net/http"
"net/url"
"path/filepath"
@@ -550,12 +549,11 @@ func (a *App) getNotificationEmailBody(recipient *model.User, post *model.Post,
t := getFormattedPostTime(recipient, post, useMilitaryTime, translateFunc)
var bodyText string
var info template.HTML
if channel.Type == model.CHANNEL_DIRECT {
if emailNotificationContentsType == model.EMAIL_NOTIFICATION_CONTENTS_FULL {
bodyText = translateFunc("app.notification.body.intro.direct.full")
info = utils.TranslateAsHtml(translateFunc, "app.notification.body.text.direct.full",
bodyPage.Props["BodyText"] = translateFunc("app.notification.body.intro.direct.full")
bodyPage.Props["Info1"] = ""
bodyPage.Props["Info2"] = translateFunc("app.notification.body.text.direct.full",
map[string]interface{}{
"SenderName": senderName,
"Hour": t.Hour,
@@ -565,10 +563,10 @@ func (a *App) getNotificationEmailBody(recipient *model.User, post *model.Post,
"Day": t.Day,
})
} else {
bodyText = translateFunc("app.notification.body.intro.direct.generic", map[string]interface{}{
bodyPage.Props["BodyText"] = translateFunc("app.notification.body.intro.direct.generic", map[string]interface{}{
"SenderName": senderName,
})
info = utils.TranslateAsHtml(translateFunc, "app.notification.body.text.direct.generic",
bodyPage.Props["Info"] = translateFunc("app.notification.body.text.direct.generic",
map[string]interface{}{
"Hour": t.Hour,
"Minute": t.Minute,
@@ -579,22 +577,25 @@ func (a *App) getNotificationEmailBody(recipient *model.User, post *model.Post,
}
} else if channel.Type == model.CHANNEL_GROUP {
if emailNotificationContentsType == model.EMAIL_NOTIFICATION_CONTENTS_FULL {
bodyText = translateFunc("app.notification.body.intro.group_message.full")
info = utils.TranslateAsHtml(translateFunc, "app.notification.body.text.group_message.full",
bodyPage.Props["BodyText"] = translateFunc("app.notification.body.intro.group_message.full")
bodyPage.Props["Info1"] = translateFunc("app.notification.body.text.group_message.full",
map[string]interface{}{
"ChannelName": channelName,
"SenderName": senderName,
"Hour": t.Hour,
"Minute": t.Minute,
"TimeZone": t.TimeZone,
"Month": t.Month,
"Day": t.Day,
})
bodyPage.Props["Info2"] = translateFunc("app.notification.body.text.group_message.full2",
map[string]interface{}{
"SenderName": senderName,
"Hour": t.Hour,
"Minute": t.Minute,
"TimeZone": t.TimeZone,
"Month": t.Month,
"Day": t.Day,
})
} else {
bodyText = translateFunc("app.notification.body.intro.group_message.generic", map[string]interface{}{
bodyPage.Props["BodyText"] = translateFunc("app.notification.body.intro.group_message.generic", map[string]interface{}{
"SenderName": senderName,
})
info = utils.TranslateAsHtml(translateFunc, "app.notification.body.text.group_message.generic",
bodyPage.Props["Info"] = translateFunc("app.notification.body.text.group_message.generic",
map[string]interface{}{
"Hour": t.Hour,
"Minute": t.Minute,
@@ -605,22 +606,25 @@ func (a *App) getNotificationEmailBody(recipient *model.User, post *model.Post,
}
} else {
if emailNotificationContentsType == model.EMAIL_NOTIFICATION_CONTENTS_FULL {
bodyText = translateFunc("app.notification.body.intro.notification.full")
info = utils.TranslateAsHtml(translateFunc, "app.notification.body.text.notification.full",
bodyPage.Props["BodyText"] = translateFunc("app.notification.body.intro.notification.full")
bodyPage.Props["Info1"] = translateFunc("app.notification.body.text.notification.full",
map[string]interface{}{
"ChannelName": channelName,
"SenderName": senderName,
"Hour": t.Hour,
"Minute": t.Minute,
"TimeZone": t.TimeZone,
"Month": t.Month,
"Day": t.Day,
})
bodyPage.Props["Info2"] = translateFunc("app.notification.body.text.notification.full2",
map[string]interface{}{
"SenderName": senderName,
"Hour": t.Hour,
"Minute": t.Minute,
"TimeZone": t.TimeZone,
"Month": t.Month,
"Day": t.Day,
})
} else {
bodyText = translateFunc("app.notification.body.intro.notification.generic", map[string]interface{}{
bodyPage.Props["BodyText"] = translateFunc("app.notification.body.intro.notification.generic", map[string]interface{}{
"SenderName": senderName,
})
info = utils.TranslateAsHtml(translateFunc, "app.notification.body.text.notification.generic",
bodyPage.Props["Info"] = translateFunc("app.notification.body.text.notification.generic",
map[string]interface{}{
"Hour": t.Hour,
"Minute": t.Minute,
@@ -631,8 +635,6 @@ func (a *App) getNotificationEmailBody(recipient *model.User, post *model.Post,
}
}
bodyPage.Props["BodyText"] = bodyText
bodyPage.Html["Info"] = info
bodyPage.Props["Button"] = translateFunc("api.templates.post_body.button")
return bodyPage.Render()