summaryrefslogtreecommitdiffstats
path: root/app/notification.go
diff options
context:
space:
mode:
authorYusuke Nemoto <kaakaa@users.noreply.github.com>2018-07-21 01:52:20 +0900
committerElias Nahum <nahumhbl@gmail.com>2018-07-20 12:52:20 -0400
commit6104c37761deb8f06ea4af8838db12b8158318be (patch)
treeb435543c08932bae6cc19415536ace1135c13f26 /app/notification.go
parent908a682fcf3bbc48db75099f636d627616757b24 (diff)
downloadchat-6104c37761deb8f06ea4af8838db12b8158318be.tar.gz
chat-6104c37761deb8f06ea4af8838db12b8158318be.tar.bz2
chat-6104c37761deb8f06ea4af8838db12b8158318be.zip
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
Diffstat (limited to 'app/notification.go')
-rw-r--r--app/notification.go60
1 files changed, 31 insertions, 29 deletions
diff --git a/app/notification.go b/app/notification.go
index a13c7bfa8..477f73a27 100644
--- a/app/notification.go
+++ b/app/notification.go
@@ -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()