Open platform to collect and prioritize feedback
feature: translate all server/email templates (#974)
Guilherme Oenning98c654cd7355
diff --git a/app/models/enum/post_status.go b/app/models/enum/post_status.goindex c8e2b0203..58fb21ff9 100644--- a/app/models/enum/post_status.go+++ b/app/models/enum/post_status.go@@ -56,5 +56,5 @@ func (status PostStatus) Name() string {if ok {return name}- return "Unknown"+ return "unknown"}diff --git a/app/pkg/tpl/funcs.go b/app/pkg/tpl/funcs.gonew file mode 100644index 000000000..0bfa9a6fa--- /dev/null+++ b/app/pkg/tpl/funcs.go@@ -0,0 +1,56 @@+package tpl++import (+ "errors"+ "html/template"+ "strings"++ "github.com/getfider/fider/app/pkg/crypto"+ "github.com/getfider/fider/app/pkg/i18n"+ "github.com/getfider/fider/app/pkg/markdown"+ "github.com/microcosm-cc/bluemonday"+)++var strictHtmlPolicy = bluemonday.NewPolicy()++var templateFunctions = template.FuncMap{+ "stripHtml": func(input string) string {+ return strictHtmlPolicy.Sanitize(input)+ },+ "html": func(input string) template.HTML {+ return template.HTML(input)+ },+ "md5": func(input string) string {+ return crypto.MD5(input)+ },+ "lower": func(input string) string {+ return strings.ToLower(input)+ },+ "upper": func(input string) string {+ return strings.ToUpper(input)+ },+ "translate": func(input string, params ...i18n.Params) string {+ return "This is overwritten later on..."+ },+ "markdown": func(input string) template.HTML {+ return markdown.Full(input)+ },+ "dict": func(values ...interface{}) map[string]interface{} {+ if len(values)%2 != 0 {+ panic(errors.New("invalid dictionary call"))+ }++ dict := make(map[string]interface{})+ for i := 0; i < len(values); i += 2 {+ var key string+ switch v := values[i].(type) {+ case string:+ key = v+ default:+ panic(errors.New("invalid dictionary key"))+ }+ dict[key] = values[i+1]+ }+ return dict+ },+}diff --git a/app/pkg/tpl/template.go b/app/pkg/tpl/template.gonew file mode 100644index 000000000..813b76d7a--- /dev/null+++ b/app/pkg/tpl/template.go@@ -0,0 +1,42 @@+package tpl++import (+ "context"+ "html/template"+ "io"+ "path"++ "github.com/getfider/fider/app/pkg/env"+ "github.com/getfider/fider/app/pkg/errors"+ "github.com/getfider/fider/app/pkg/i18n"+)++var cache = make(map[string]*template.Template)++func GetTemplate(baseFileName, templateFileName string) *template.Template {+ tmpl, ok := cache[templateFileName]+ if ok && !env.IsDevelopment() {+ return tmpl+ }++ baseFile := env.Path(baseFileName)+ templateFile := env.Path(templateFileName)+ tpl, err := template.New(path.Base(baseFile)).Funcs(templateFunctions).ParseFiles(baseFile, templateFile)+ if err != nil {+ panic(errors.Wrap(err, "failed to parse template %s", templateFileName))+ }++ cache[templateFileName] = tpl+ return tpl+}++func Render(ctx context.Context, tmpl *template.Template, w io.Writer, data interface{}) error {+ if err := template.Must(tmpl.Clone()).Funcs(template.FuncMap{+ "translate": func(key string, params ...i18n.Params) string {+ return i18n.T(ctx, key, params...)+ },+ }).Execute(w, data); err != nil {+ return err+ }+ return nil+}diff --git a/app/pkg/tpl/template_test.go b/app/pkg/tpl/template_test.gonew file mode 100644index 000000000..2b4c6933f--- /dev/null+++ b/app/pkg/tpl/template_test.go@@ -0,0 +1,29 @@+package tpl_test++import (+ "bytes"+ "context"+ "testing"++ "github.com/getfider/fider/app/models/dto"+ . "github.com/getfider/fider/app/pkg/assert"+ "github.com/getfider/fider/app/pkg/tpl"+)++func TestGetTemplate_Render(t *testing.T) {+ RegisterT(t)++ bf := new(bytes.Buffer)+ tmpl := tpl.GetTemplate("app/pkg/tpl/testdata/base.html", "app/pkg/tpl/testdata/echo.html")+ err := tpl.Render(context.Background(), tmpl, bf, dto.Props{+ "name": "John",+ })++ Expect(err).IsNil()+ Expect(bf.String()).Equals(`<html>+ <head>This goes on the head.</head>+ <body>+ Hello, John!+</body>+</html>`)+}diff --git a/app/pkg/tpl/testdata/base.html b/app/pkg/tpl/testdata/base.htmlnew file mode 100644index 000000000..286b1082f--- /dev/null+++ b/app/pkg/tpl/testdata/base.html@@ -0,0 +1,4 @@+<html>+ <head>{{block "head" .}}{{end}}</head>+ <body>{{block "body" .}}{{end}}</body>+</html>\ No newline at end of filediff --git a/app/pkg/tpl/testdata/echo.html b/app/pkg/tpl/testdata/echo.htmlnew file mode 100644index 000000000..807b3adcb--- /dev/null+++ b/app/pkg/tpl/testdata/echo.html@@ -0,0 +1,5 @@+{{define "head"}}This goes on the head.{{end}}++{{define "body"}}+ {{ translate "email.greetings_name" (dict "name" .name) | html }}+{{end}}\ No newline at end of filediff --git a/app/pkg/web/react_test.go b/app/pkg/web/react_test.goindex dba17468c..365ec86b8 100644--- a/app/pkg/web/react_test.go+++ b/app/pkg/web/react_test.go@@ -38,7 +38,7 @@ func TestReactRenderer_RenderEmptyHomeHTML(t *testing.T) {u, _ := url.Parse("https://demo.test.fider.io")html, err := r.Render(u, web.Map{- "tenant": &entity.Tenant{},+ "tenant": &entity.Tenant{},"settings": web.Map{"locale": "en",},@@ -61,10 +61,10 @@ func TestReactRenderer_RenderEmptyHomeHTML_Portuguese(t *testing.T) {r, err := web.NewReactRenderer("ssr.js")Expect(err).IsNil()-+u, _ := url.Parse("https://demo.test.fider.io")html, err := r.Render(u, web.Map{- "tenant": &entity.Tenant{},+ "tenant": &entity.Tenant{},"settings": web.Map{"locale": "pt-BR",},@@ -77,7 +77,7 @@ func TestReactRenderer_RenderEmptyHomeHTML_Portuguese(t *testing.T) {Expect(html).ContainsSubstring(`<div class="c-dev-banner">DEV</div>`)Expect(html).ContainsSubstring(`<input type="text" class="c-input" id="input-title"`)Expect(html).ContainsSubstring(`What can we do better? This is the place for you to vote, discuss and share ideas.`)- Expect(html).ContainsSubstring(`Nenhum post foi criado ainda.`)+ Expect(html).ContainsSubstring(`Nenhuma postagem foi criada ainda.`)Expect(html).ContainsSubstring(`Powered by Fider`)Expect(err).IsNil()}diff --git a/app/pkg/web/renderer.go b/app/pkg/web/renderer.goindex 5d5a12f70..dfcc246cd 100644--- a/app/pkg/web/renderer.go+++ b/app/pkg/web/renderer.go@@ -13,53 +13,15 @@ import ("github.com/getfider/fider/app/models/query""github.com/getfider/fider/app/pkg/bus"- "github.com/getfider/fider/app/pkg/i18n""github.com/getfider/fider/app/pkg/log"+ "github.com/getfider/fider/app/pkg/tpl""io/ioutil"- "github.com/getfider/fider/app/pkg/crypto""github.com/getfider/fider/app/pkg/env""github.com/getfider/fider/app/pkg/errors"- "github.com/getfider/fider/app/pkg/markdown")-var templateFunctions = template.FuncMap{- "html": func(input string) template.HTML {- return template.HTML(input)- },- "md5": func(input string) string {- return crypto.MD5(input)- },- "upper": func(input string) string {- return strings.ToUpper(input)- },- "translate": func(input string, params ...i18n.Params) string {- return "This is overwritten later on..."- },- "markdown": func(input string) template.HTML {- return markdown.Full(input)- },- "dict": func(values ...interface{}) map[string]interface{} {- if len(values)%2 != 0 {- panic(errors.New("invalid dictionary call"))- }-- dict := make(map[string]interface{})- for i := 0; i < len(values); i += 2 {- var key string- switch v := values[i].(type) {- case string:- key = v- default:- panic(errors.New("invalid dictionary key"))- }- dict[key] = values[i+1]- }- return dict- },-}-type clientAssets struct {CSS []stringJS []string@@ -104,19 +66,6 @@ func NewRenderer() *Renderer {}}-//Render a template based on parameters-func (r *Renderer) add(name string) *template.Template {- base := env.Path("/views/base.html")- file := env.Path("/views", name)- tpl, err := template.New("base.html").Funcs(templateFunctions).ParseFiles(base, file)- if err != nil {- panic(errors.Wrap(err, "failed to parse template %s", file))- }-- r.templates[name] = tpl- return tpl-}-func (r *Renderer) loadAssets() error {r.mutex.Lock()defer r.mutex.Unlock()@@ -217,7 +166,7 @@ func (r *Renderer) Render(w io.Writer, statusCode int, templateName string, propprivate["assets"] = r.assetsprivate["logo"] = LogoURL(ctx)-+localeChunkName := fmt.Sprintf("locale-%s-client-json", env.Config.Locale)private["preloadAssets"] = []*clientAssets{r.chunkedAssets[localeChunkName],@@ -291,16 +240,8 @@ func (r *Renderer) Render(w io.Writer, statusCode int, templateName string, prop}}- tmpl, ok := r.templates[templateName]- if !ok || env.IsDevelopment() {- tmpl = r.add(templateName)- }-- err = template.Must(tmpl.Clone()).Funcs(template.FuncMap{- "translate": func(key string, params ...i18n.Params) string {- return i18n.T(ctx, key, params...)- },- }).Execute(w, Map{+ tmpl := tpl.GetTemplate("/views/base.html", "/views/"+templateName)+ err = tpl.Render(ctx, tmpl, w, Map{"public": public,"private": private,})diff --git a/app/services/email/email_test.go b/app/services/email/email_test.goindex 6a6e49e9e..6edb88a3c 100644--- a/app/services/email/email_test.go+++ b/app/services/email/email_test.go@@ -33,7 +33,9 @@ func TestRenderMessage(t *testing.T) {<tr><td align="center"><table bgcolor="#FFFFFF" cellpadding="0" cellspacing="0" border="0" style="text-align:left;padding:20px;margin:10px;border-radius:5px;color:#1c262d;border:1px solid #ECECEC;min-width:320px;max-width:660px;">- Hello World Fider!++Hello World Fider!+</table></td></tr>diff --git a/app/services/email/mailgun/mailgun_test.go b/app/services/email/mailgun/mailgun_test.goindex adfbb039e..ff0adef47 100644--- a/app/services/email/mailgun/mailgun_test.go+++ b/app/services/email/mailgun/mailgun_test.go@@ -80,7 +80,9 @@ func TestSend_Success(t *testing.T) {<tr><td align="center"><table bgcolor="#FFFFFF" cellpadding="0" cellspacing="0" border="0" style="text-align:left;padding:20px;margin:10px;border-radius:5px;color:#1c262d;border:1px solid #ECECEC;min-width:320px;max-width:660px;">- Hello World Hello!++Hello World Hello!+</table></td></tr>@@ -202,7 +204,9 @@ func TestBatch_Success(t *testing.T) {<tr><td align="center"><table bgcolor="#FFFFFF" cellpadding="0" cellspacing="0" border="0" style="text-align:left;padding:20px;margin:10px;border-radius:5px;color:#1c262d;border:1px solid #ECECEC;min-width:320px;max-width:660px;">- Hello World %recipient.name%!++Hello World %recipient.name%!+</table></td></tr>diff --git a/app/services/email/message.go b/app/services/email/message.goindex 972896115..b61d75fd5 100644--- a/app/services/email/message.go+++ b/app/services/email/message.go@@ -3,63 +3,33 @@ package emailimport ("bytes""context"- "html/template""strings""github.com/getfider/fider/app/models/dto"- "github.com/getfider/fider/app/pkg/env"- "github.com/getfider/fider/app/pkg/i18n"+ "github.com/getfider/fider/app/pkg/tpl")-var cache = make(map[string]*template.Template)-// Message represents what is sent by emailtype Message struct {Subject stringBody string}-var baseTpl = template.Must(template.New("base_email.tpl").Funcs(template.FuncMap{- "translate": func(input string) string {- return "This is overwritten later on..."- },-}).ParseFiles(env.Path("/views/templates/base_email.tpl")))-// RenderMessage returns the HTML of an email based on template and paramsfunc RenderMessage(ctx context.Context, templateName string, params dto.Props) *Message {- tpl, ok := cache[templateName]- if !ok || env.IsDevelopment() {- var err error- file := env.Path("/views/templates", templateName+".tpl")- tpl, err = template.ParseFiles(file)- if err != nil {- panic(err)- }- cache[templateName] = tpl- }-+ tmpl := tpl.GetTemplate("/views/email/base_email.html", "/views/email/"+templateName+".html")var bf bytes.Buffer- if err := tpl.Execute(&bf, params); err != nil {+ if err := tpl.Render(ctx, tmpl, &bf, params.Merge(dto.Props{+ "logo": params["logo"],+ })); err != nil {panic(err)}lines := strings.Split(bf.String(), "\n")body := strings.TrimLeft(strings.Join(lines[2:], "\n"), " ")- bf.Reset()- if err := template.Must( baseTpl.Clone()).Funcs(template.FuncMap{- "translate": func(key string) string {- return i18n.T(ctx, key)- },- }).Execute(&bf, dto.Props{- "logo": params["logo"],- "body": template.HTML(body),- }); err != nil {- panic(err)- }-return &Message{Subject: strings.TrimLeft(lines[0], "subject: "),- Body: bf.String(),+ Body: body,}}diff --git a/app/tasks/tasks.go b/app/tasks/tasks.goindex 1870f79b4..dcfeb5e76 100644--- a/app/tasks/tasks.go+++ b/app/tasks/tasks.go@@ -3,7 +3,6 @@ package tasksimport ("context""fmt"- "html/template""strings""time"@@ -15,6 +14,7 @@ import ("github.com/getfider/fider/app/models/enum""github.com/getfider/fider/app/models/query""github.com/getfider/fider/app/pkg/bus"+ "github.com/getfider/fider/app/pkg/i18n""github.com/getfider/fider/app/pkg/markdown""github.com/getfider/fider/app/pkg/web""github.com/getfider/fider/app/pkg/worker"@@ -24,12 +24,12 @@ func describe(name string, job worker.Job) worker.Task {return worker.Task{Name: name, Job: job}}-func link(baseURL, path string, args ...interface{}) template.HTML {- return template.HTML(fmt.Sprintf("<a href='%[1]s%[2]s'>%[1]s%[2]s</a>", baseURL, fmt.Sprintf(path, args...)))+func link(baseURL, path string, args ...interface{}) string {+ return fmt.Sprintf("<a href='%[1]s%[2]s'>%[1]s%[2]s</a>", baseURL, fmt.Sprintf(path, args...))}-func linkWithText(text, baseURL, path string, args ...interface{}) template.HTML {- return template.HTML(fmt.Sprintf("<a href='%s%s'>%s</a>", baseURL, fmt.Sprintf(path, args...), text))+func linkWithText(text, baseURL, path string, args ...interface{}) string {+ return fmt.Sprintf("<a href='%s%s'>%s</a>", baseURL, fmt.Sprintf(path, args...), text)}//SendSignUpEmail is used to send the sign up email to requestor@@ -56,8 +56,8 @@ func SendSignUpEmail(action *actions.CreateTenant, baseURL string) worker.Task {func SendSignInEmail(email, verificationKey string) worker.Task {return describe("Send sign in email", func(c *worker.Context) error {to := dto.NewRecipient("", email, dto.Props{- "tenantName": c.Tenant().Name,- "link": link(web.BaseURL(c), "/signin/verify?k=%s", verificationKey),+ "siteName": c.Tenant().Name,+ "link": link(web.BaseURL(c), "/signin/verify?k=%s", verificationKey),})bus.Publish(c, &cmd.SendMail{@@ -141,14 +141,14 @@ func NotifyAboutNewPost(post *entity.Post) worker.Task {}props := dto.Props{- "title": post.Title,- "tenantName": c.Tenant().Name,- "userName": c.User().Name,- "content": markdown.Full(post.Description),- "postLink": linkWithText(fmt.Sprintf("#%d", post.Number), web.BaseURL(c), "/posts/%d/%s", post.Number, post.Slug),- "view": linkWithText("view it on your browser", web.BaseURL(c), "/posts/%d/%s", post.Number, post.Slug),- "change": linkWithText("change your notification preferences", web.BaseURL(c), "/settings"),- "logo": web.LogoURL(c),+ "title": post.Title,+ "siteName": c.Tenant().Name,+ "userName": c.User().Name,+ "content": markdown.Full(post.Description),+ "postLink": linkWithText(fmt.Sprintf("#%d", post.Number), web.BaseURL(c), "/posts/%d/%s", post.Number, post.Slug),+ "view": linkWithText(i18n.T(c, "email.subscription.view"), web.BaseURL(c), "/posts/%d/%s", post.Number, post.Slug),+ "change": linkWithText(i18n.T(c, "email.subscription.change"), web.BaseURL(c), "/settings"),+ "logo": web.LogoURL(c),}bus.Publish(c, &cmd.SendMail{@@ -202,13 +202,13 @@ func NotifyAboutNewComment(post *entity.Post, comment string) worker.Task {props := dto.Props{"title": post.Title,- "tenantName": c.Tenant().Name,+ "siteName": c.Tenant().Name,"userName": c.User().Name,"content": markdown.Full(comment),"postLink": linkWithText(fmt.Sprintf("#%d", post.Number), web.BaseURL(c), "/posts/%d/%s", post.Number, post.Slug),- "view": linkWithText("view it on your browser", web.BaseURL(c), "/posts/%d/%s", post.Number, post.Slug),- "unsubscribe": linkWithText("unsubscribe from it", web.BaseURL(c), "/posts/%d/%s", post.Number, post.Slug),- "change": linkWithText("change your notification preferences", web.BaseURL(c), "/settings"),+ "view": linkWithText(i18n.T(c, "email.subscription.view"), web.BaseURL(c), "/posts/%d/%s", post.Number, post.Slug),+ "unsubscribe": linkWithText(i18n.T(c, "email.subscription.unsubscribe"), web.BaseURL(c), "/posts/%d/%s", post.Number, post.Slug),+ "change": linkWithText(i18n.T(c, "email.subscription.change"), web.BaseURL(c), "/settings"),"logo": web.LogoURL(c),}@@ -259,7 +259,7 @@ func NotifyAboutStatusChange(post *entity.Post, prevStatus enum.PostStatus) workreturn c.Failure(err)}- var duplicate template.HTML+ var duplicate stringif post.Status == enum.PostDuplicate {duplicate = linkWithText(post.Response.Original.Title, web.BaseURL(c), "/posts/%d/%s", post.Response.Original.Number, post.Response.Original.Slug)}@@ -274,13 +274,13 @@ func NotifyAboutStatusChange(post *entity.Post, prevStatus enum.PostStatus) workprops := dto.Props{"title": post.Title,"postLink": linkWithText(fmt.Sprintf("#%d", post.Number), web.BaseURL(c), "/posts/%d/%s", post.Number, post.Slug),- "tenantName": c.Tenant().Name,+ "siteName": c.Tenant().Name,"content": markdown.Full(post.Response.Text),- "status": post.Status.Name(),+ "status": i18n.T(c, fmt.Sprintf("post_status.%s", post.Status.Name())),"duplicate": duplicate,- "view": linkWithText("view it on your browser", web.BaseURL(c), "/posts/%d/%s", post.Number, post.Slug),- "unsubscribe": linkWithText("unsubscribe from it", web.BaseURL(c), "/posts/%d/%s", post.Number, post.Slug),- "change": linkWithText("change your notification preferences", web.BaseURL(c), "/settings"),+ "view": linkWithText(i18n.T(c, "email.subscription.view"), web.BaseURL(c), "/posts/%d/%s", post.Number, post.Slug),+ "unsubscribe": linkWithText(i18n.T(c, "email.subscription.unsubscribe"), web.BaseURL(c), "/posts/%d/%s", post.Number, post.Slug),+ "change": linkWithText(i18n.T(c, "email.subscription.change"), web.BaseURL(c), "/settings"),"logo": web.LogoURL(c),}@@ -333,11 +333,11 @@ func NotifyAboutDeletedPost(post *entity.Post) worker.Task {}props := dto.Props{- "title": post.Title,- "tenantName": c.Tenant().Name,- "content": markdown.Full(post.Response.Text),- "change": linkWithText("change your notification preferences", web.BaseURL(c), "/settings"),- "logo": web.LogoURL(c),+ "title": post.Title,+ "siteName": c.Tenant().Name,+ "content": markdown.Full(post.Response.Text),+ "change": linkWithText(i18n.T(c, "email.subscription.change"), web.BaseURL(c), "/settings"),+ "logo": web.LogoURL(c),}bus.Publish(c, &cmd.SendMail{diff --git a/app/tasks/tasks_test.go b/app/tasks/tasks_test.goindex 912348a4c..4fcd6f71f 100644--- a/app/tasks/tasks_test.go+++ b/app/tasks/tasks_test.go@@ -44,7 +44,7 @@ func TestSendSignUpEmailTask(t *testing.T) {Expect(emailmock.MessageHistory[0].To).HasLen(1)Expect(emailmock.MessageHistory[0].To[0]).Equals(dto.Recipient{Props: dto.Props{- "link": template.HTML("<a href='http://domain.com/signup/verify?k=1234'>http://domain.com/signup/verify?k=1234</a>"),+ "link": "<a href='http://domain.com/signup/verify?k=1234'>http://domain.com/signup/verify?k=1234</a>",},})}@@ -74,8 +74,8 @@ func TestSendSignInEmailTask(t *testing.T) {Expect(emailmock.MessageHistory[0].To[0]).Equals(dto.Recipient{Address: "[email protected]",Props: dto.Props{- "tenantName": mock.DemoTenant.Name,- "link": template.HTML("<a href='http://domain.com/signin/verify?k=9876'>http://domain.com/signin/verify?k=9876</a>"),+ "siteName": mock.DemoTenant.Name,+ "link": "<a href='http://domain.com/signin/verify?k=9876'>http://domain.com/signin/verify?k=9876</a>",},})}@@ -113,7 +113,7 @@ func TestSendChangeEmailConfirmationTask(t *testing.T) {"name": "Jon Snow","oldEmail": "[email protected]","newEmail": "[email protected]",- "link": template.HTML("<a href='http://domain.com/change-email/verify?k=13579'>http://domain.com/change-email/verify?k=13579</a>"),+ "link": "<a href='http://domain.com/change-email/verify?k=13579'>http://domain.com/change-email/verify?k=13579</a>",},})}@@ -156,14 +156,14 @@ func TestNotifyAboutNewPostTask(t *testing.T) {Expect(emailmock.MessageHistory[0].TemplateName).Equals("new_post")Expect(emailmock.MessageHistory[0].Tenant).Equals(mock.DemoTenant)Expect(emailmock.MessageHistory[0].Props).Equals(dto.Props{- "title": "Add support for TypeScript",- "postLink": template.HTML("<a href='http://domain.com/posts/1/add-support-for-typescript'>#1</a>"),- "tenantName": "Demonstration",- "userName": "Jon Snow",- "content": template.HTML("<p>TypeScript is great, please add support for it</p>"),- "view": template.HTML("<a href='http://domain.com/posts/1/add-support-for-typescript'>view it on your browser</a>"),- "change": template.HTML("<a href='http://domain.com/settings'>change your notification preferences</a>"),- "logo": "https://getfider.com/images/logo-100x100.png",+ "title": "Add support for TypeScript",+ "postLink": "<a href='http://domain.com/posts/1/add-support-for-typescript'>#1</a>",+ "siteName": "Demonstration",+ "userName": "Jon Snow",+ "content": template.HTML("<p>TypeScript is great, please add support for it</p>"),+ "view": "<a href='http://domain.com/posts/1/add-support-for-typescript'>view it on your browser</a>",+ "change": "<a href='http://domain.com/settings'>change your notification preferences</a>",+ "logo": "https://getfider.com/images/logo-100x100.png",})Expect(emailmock.MessageHistory[0].From).Equals("Jon Snow")Expect(emailmock.MessageHistory[0].To).HasLen(1)@@ -219,13 +219,13 @@ func TestNotifyAboutNewCommentTask(t *testing.T) {Expect(emailmock.MessageHistory[0].Tenant).Equals(mock.DemoTenant)Expect(emailmock.MessageHistory[0].Props).Equals(dto.Props{"title": "Add support for TypeScript",- "postLink": template.HTML("<a href='http://domain.com/posts/1/add-support-for-typescript'>#1</a>"),- "tenantName": "Demonstration",+ "postLink": "<a href='http://domain.com/posts/1/add-support-for-typescript'>#1</a>",+ "siteName": "Demonstration","userName": "Arya Stark","content": template.HTML("<p>I agree</p>"),- "view": template.HTML("<a href='http://domain.com/posts/1/add-support-for-typescript'>view it on your browser</a>"),- "change": template.HTML("<a href='http://domain.com/settings'>change your notification preferences</a>"),- "unsubscribe": template.HTML("<a href='http://domain.com/posts/1/add-support-for-typescript'>unsubscribe from it</a>"),+ "view": "<a href='http://domain.com/posts/1/add-support-for-typescript'>view it on your browser</a>",+ "change": "<a href='http://domain.com/settings'>change your notification preferences</a>",+ "unsubscribe": "<a href='http://domain.com/posts/1/add-support-for-typescript'>unsubscribe from it</a>","logo": "https://getfider.com/images/logo-100x100.png",})Expect(emailmock.MessageHistory[0].From).Equals("Arya Stark")@@ -289,14 +289,14 @@ func TestNotifyAboutStatusChangeTask(t *testing.T) {Expect(emailmock.MessageHistory[0].Tenant).Equals(mock.DemoTenant)Expect(emailmock.MessageHistory[0].Props).Equals(dto.Props{"title": "Add support for TypeScript",- "postLink": template.HTML("<a href='http://domain.com/posts/1/add-support-for-typescript'>#1</a>"),- "tenantName": "Demonstration",+ "postLink": "<a href='http://domain.com/posts/1/add-support-for-typescript'>#1</a>",+ "siteName": "Demonstration","content": template.HTML("<p>Planned for next release.</p>"),- "duplicate": template.HTML(""),- "status": "planned",- "view": template.HTML("<a href='http://domain.com/posts/1/add-support-for-typescript'>view it on your browser</a>"),- "change": template.HTML("<a href='http://domain.com/settings'>change your notification preferences</a>"),- "unsubscribe": template.HTML("<a href='http://domain.com/posts/1/add-support-for-typescript'>unsubscribe from it</a>"),+ "duplicate": "",+ "status": "Planned",+ "view": "<a href='http://domain.com/posts/1/add-support-for-typescript'>view it on your browser</a>",+ "change": "<a href='http://domain.com/settings'>change your notification preferences</a>",+ "unsubscribe": "<a href='http://domain.com/posts/1/add-support-for-typescript'>unsubscribe from it</a>","logo": "https://getfider.com/images/logo-100x100.png",})Expect(emailmock.MessageHistory[0].From).Equals("Jon Snow")@@ -359,11 +359,11 @@ func TestNotifyAboutDeletePostTask(t *testing.T) {Expect(emailmock.MessageHistory[0].TemplateName).Equals("delete_post")Expect(emailmock.MessageHistory[0].Tenant).Equals(mock.DemoTenant)Expect(emailmock.MessageHistory[0].Props).Equals(dto.Props{- "title": "Add support for TypeScript",- "tenantName": "Demonstration",- "content": template.HTML("<p>Invalid post!</p>"),- "change": template.HTML("<a href='http://domain.com/settings'>change your notification preferences</a>"),- "logo": "https://getfider.com/images/logo-100x100.png",+ "title": "Add support for TypeScript",+ "siteName": "Demonstration",+ "content": template.HTML("<p>Invalid post!</p>"),+ "change": "<a href='http://domain.com/settings'>change your notification preferences</a>",+ "logo": "https://getfider.com/images/logo-100x100.png",})Expect(emailmock.MessageHistory[0].From).Equals("Jon Snow")Expect(emailmock.MessageHistory[0].To).HasLen(1)@@ -430,14 +430,14 @@ func TestNotifyAboutStatusChangeTask_Duplicate(t *testing.T) {Expect(emailmock.MessageHistory[0].Tenant).Equals(mock.DemoTenant)Expect(emailmock.MessageHistory[0].Props).Equals(dto.Props{"title": "I need TypeScript",- "postLink": template.HTML("<a href='http://domain.com/posts/2/i-need-typescript'>#2</a>"),- "tenantName": "Demonstration",+ "postLink": "<a href='http://domain.com/posts/2/i-need-typescript'>#2</a>",+ "siteName": "Demonstration","content": template.HTML(""),- "duplicate": template.HTML("<a href='http://domain.com/posts/1/add-support-for-typescript'>Add support for TypeScript</a>"),- "status": "duplicate",- "view": template.HTML("<a href='http://domain.com/posts/2/i-need-typescript'>view it on your browser</a>"),- "change": template.HTML("<a href='http://domain.com/settings'>change your notification preferences</a>"),- "unsubscribe": template.HTML("<a href='http://domain.com/posts/2/i-need-typescript'>unsubscribe from it</a>"),+ "duplicate": "<a href='http://domain.com/posts/1/add-support-for-typescript'>Add support for TypeScript</a>",+ "status": "Duplicate",+ "view": "<a href='http://domain.com/posts/2/i-need-typescript'>view it on your browser</a>",+ "change": "<a href='http://domain.com/settings'>change your notification preferences</a>",+ "unsubscribe": "<a href='http://domain.com/posts/2/i-need-typescript'>unsubscribe from it</a>","logo": "https://getfider.com/images/logo-100x100.png",})Expect(emailmock.MessageHistory[0].From).Equals("Jon Snow")diff --git a/go.mod b/go.modindex 83a8a5397..1c8250fec 100644--- a/go.mod+++ b/go.mod@@ -19,10 +19,11 @@ require (github.com/joho/godotenv v1.3.0github.com/julienschmidt/httprouter v1.3.0github.com/lib/pq v1.9.0+ github.com/microcosm-cc/bluemonday v1.0.14github.com/patrickmn/go-cache v2.1.0+incompatiblegithub.com/russross/blackfriday v1.6.0golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83- golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb+ golang.org/x/net v0.0.0-20210610132358-84b48f89b13bgolang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93rogchap.com/v8go v0.6.0)diff --git a/go.sum b/go.sumindex 6c812fd5c..7b0b3d89c 100644--- a/go.sum+++ b/go.sum@@ -59,6 +59,8 @@ github.com/ashanbrown/makezero v0.0.0-20201205152432-7b7cdbb3025a h1:/U9tbJzDRofgithub.com/ashanbrown/makezero v0.0.0-20201205152432-7b7cdbb3025a/go.mod h1:oG9Dnez7/ESBqc4EdrdNlryeo7d0KcW1ftXHm7nU/UU=github.com/aws/aws-sdk-go v1.37.25 h1:q1C/ILIVusSmqgWG4tFU0uVt3Zm+1I3L2BmNCd2Ug4Q=github.com/aws/aws-sdk-go v1.37.25/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro=+github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk=+github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4=github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=@@ -235,6 +237,8 @@ github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGagithub.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=github.com/gordonklaus/ineffassign v0.0.0-20210225214923-2e10b2664254 h1:Nb2aRlC404yz7gQIfRZxX9/MLvQiqXyiBTJtgAy6yrI=github.com/gordonklaus/ineffassign v0.0.0-20210225214923-2e10b2664254/go.mod h1:M9mZEtGIsR1oDaZagNPNG9iq9n2HrhZ17dsXk73V3Lw=+github.com/gorilla/css v1.0.0 h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY=+github.com/gorilla/css v1.0.0/go.mod h1:Dn721qIggHpt4+EFCcTLTU/vk5ySda2ReITrtgBl60c=github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=github.com/gosimple/slug v1.9.0 h1:r5vDcYrFz9BmfIAMC829un9hq7hKM4cHUrsv36LbEqs=github.com/gosimple/slug v1.9.0/go.mod h1:AMZ+sOVe65uByN3kgEyf9WEBKBCSS+dJjMX9x4vDJbg=@@ -364,6 +368,8 @@ github.com/mgechev/dots v0.0.0-20190921121421-c36f7dcfbb81 h1:QASJXOGm2RZ5Ardbc8github.com/mgechev/dots v0.0.0-20190921121421-c36f7dcfbb81/go.mod h1:KQ7+USdGKfpPjXk4Ga+5XxQM4Lm4e3gAogrreFAYpOg=github.com/mgechev/revive v1.0.3 h1:z3FL6IFFN3JKzHYHD8O1ExH9g/4lAGJ5x1+9rPZgsFg=github.com/mgechev/revive v1.0.3/go.mod h1:POGGZagSo/0frdr7VeAifzS5Uka0d0GPiM35MsTO8nE=+github.com/microcosm-cc/bluemonday v1.0.14 h1:Djd+GeTanVeA23todvVC0AO5hsI+vAwQMLTy794Zr5I=+github.com/microcosm-cc/bluemonday v1.0.14/go.mod h1:beubO5lmWoy1tU8niaMyXNriNgROO37H3U/tsrcZsy0=github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=@@ -622,8 +628,9 @@ golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Rgolang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=-golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb h1:eBmm0M9fYhWpKZLjQUUKka/LtIxf46G4fxeEz5KJr9U=golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=+golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A=+golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=@@ -684,15 +691,19 @@ golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980/go.mod h1:h1NjWce9XRLGQEsW7wgolang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=golang.org/x/sys v0.0.0-20201024232916-9f70ab9862d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=-golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4 h1:myAQVi0cGEoqQVR5POX+8RR2mrocKqNN1hmeMqhX27k=+golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=+golang.org/x/sys v0.0.0-20210423082822-04245dca01da h1:b3NXsE2LusjYGGjL5bxEVZZORm/YEFFrWFjR8eFrw/c=+golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=+golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=-golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=+golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=+golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=diff --git a/locale/en/server.json b/locale/en/server.jsonindex b6f140f6a..d44cc55aa 100644--- a/locale/en/server.json+++ b/locale/en/server.json@@ -1,6 +1,49 @@{+ "post_status.open": "Open",+ "post_status.started": "Started",+ "post_status.completed": "Completed",+ "post_status.declined": "Declined",+ "post_status.planned": "Planned",+ "post_status.duplicate": "Duplicate",+ "post_status.deleted": "Deleted","error.pagenotfound.title": "Page not found",- "error.backhome": "Take me back to <a class=\"{className}\" href=\"{url}\">{url}</a> home page.",+ "error.pagenotfound.text": "The link you clicked may be broken or the page may have been removed.",+ "error.unauthorized.title": "Not Authorized",+ "error.unauthorized.text": "You are not authorized to view this page.",+ "error.expired.title": "Expired",+ "error.expired.text": "The link you clicked has expired.",+ "error.internalerror.title": "Shoot! Well, this is unexpected…",+ "error.internalerror.text": "An error has occurred and we're working to fix the problem! We’ll be up and running shortly.",+ "page.notinvited.title": "Not invited",+ "page.notinvited.text": "We could not find an account for your email address.",+ "page.pendingactivation.title": "Your account is pending activation",+ "page.pendingactivation.text": "We sent you a confirmation email with a link to activate your site.",+ "page.pendingactivation.text2": "Please check your inbox to activate it.",+ "page.backhome": "Take me back to <a class=\"{className}\" href=\"{url}\">{url}</a> home page.",+ "validation.settings.unknown": "Unknown settings named '{name}'",+ "email.change_emailaddress.subject": "Confirm your new email",+ "email.change_emailaddress.request": "You have requested to change your email from {oldEmail} to {newEmail}.",+ "email.subscription.view": "view it on your browser",+ "email.subscription.change": "change your notification preferences",+ "email.subscription.unsubscribe": "unsubscribe from it",+ "email.greetings": "Hello!",+ "email.greetings_name": "Hello, {name}!",+ "email.operation_confirmation": "Click the link below to confirm this operation.",+ "email.expire_note_hours": "Note: This link will expire in {hours} hours and can only be used one time.",+ "email.expire_note_minutes": "Note: This link will expire in {minutes} minutes and can only be used one time.","email.footer.noreply": "This email was sent from a notification-only address that cannot accept incoming email. Please do not reply to this message.",- "validation.settings.unknown": "Unknown settings named '{name}'"+ "email.change_status.duplicate": "<strong>{title} ({postLink})</strong> has been closed as a <strong>duplicate</strong> of {duplicate}.",+ "email.change_status.others": "Status of <strong>{title} ({postLink})</strong> has changed to <strong>{status}</strong>.",+ "email.delete_post.text": "<strong>{title}</strong> has been <strong>deleted</strong>.",+ "email.new_comment.text": "<strong>{userName}</strong> left a comment on <strong>{title} ({postLink})</strong>.",+ "email.new_post.text": "<strong>{userName}</strong> created a new post <strong>{title} ({postLink})</strong>.",+ "email.signin_email.subject": "Sign in to {siteName}",+ "email.signin_email.text": "You asked us to send you a sign-in link and here it is.",+ "email.signin_email.confirmation": "Click the link below to sign in to <strong>{siteName}</strong>.",+ "email.signup_email.subject": "Your new Fider site",+ "email.signup_email.text": "You are one step away from activating your Fider site.",+ "email.signup_email.confirmation": "Through the link below you can verify your email address and complete the activation process.",+ "email.footer.subscription_notice": "You are receiving this email because you are subscribed to this post. You can {view}, {unsubscribe} or {change}.",+ "email.footer.subscription_notice2": "You are receiving this email because you are subscribed to this post. You can {change}.",+ "email.footer.subscription_notice3": "You are receiving this email because you are subscribed to this post. You can {view} or {change}."}diff --git a/locale/pt-BR/client.json b/locale/pt-BR/client.jsonindex 4e08be6b4..19c04c52e 100644--- a/locale/pt-BR/client.json+++ b/locale/pt-BR/client.json@@ -1,7 +1,7 @@{"home.lonely.suggestion": "É recomendável que você crie <0>pelo menos 3</0> sugestões aqui antes de compartilhar este site. O conteúdo inicial é importante para começar a engajar seu público.",- "home.lonely.text": "Nenhum post foi criado ainda.",- "home.similar.subtitle": "Considere votar em posts existentes.",- "home.similar.title": "Posts similares",+ "home.lonely.text": "Nenhuma postagem foi criada ainda.",+ "home.similar.subtitle": "Considere votar em postagens existentes.",+ "home.similar.title": "Postagens similares","invitations.submit": "{0, plural, one {Envie # convite} other {Envie # convites}}"}\ No newline at end of filediff --git a/locale/pt-BR/server.json b/locale/pt-BR/server.jsonindex da4b6cdea..1f3100c0b 100644--- a/locale/pt-BR/server.json+++ b/locale/pt-BR/server.json@@ -1,6 +1,49 @@{+ "post_status.open": "Aberto",+ "post_status.started": "Iniciado",+ "post_status.completed": "Completado",+ "post_status.declined": "Rejeitado",+ "post_status.planned": "Planejado",+ "post_status.duplicate": "Duplicado",+ "post_status.deleted": "Removido","error.pagenotfound.title": "Página não encontrada",- "error.backhome": "Me leve de volta para a página inicial <a class=\"{className}\" href=\"{url}\">{url}</a>.",- "email.footer.noreply": "Este email foi enviado de uma caixa postal que não pode receber emails. Favor não responder este email.",- "validation.settings.unknown": "Configuração '{name}' é desconhecida"+ "error.pagenotfound.text": "O link que você acessou pode estar quebrado ou a página pode ter sido removida.",+ "error.unauthorized.title": "Não autorizado",+ "error.unauthorized.text": "Sem permissão para acessar esta página.",+ "error.expired.title": "Expirado",+ "error.expired.text": "O link que você acessou expirou.",+ "error.internalerror.title": "Oops, isto não era experado…",+ "error.internalerror.text": "Desculpe, algo deu errado. Estamos trabalhando nisso e vamos corrigi-lo o mais rápido possível.",+ "page.notinvited.title": "Sem convite",+ "page.notinvited.text": "Não encontramos nenhuma conta para o seu endereço de e-mail.",+ "page.pendingactivation.title": "Sua conta está com ativação pendente",+ "page.pendingactivation.text": "Enviamos a você um e-mail de confirmação com um link para ativar o seu site.",+ "page.pendingactivation.text2": "Verifique sua caixa de entrada para ativá-la.",+ "page.backhome": "Me leve de volta para a página inicial <a class=\"{className}\" href=\"{url}\">{url}</a>.",+ "validation.settings.unknown": "Configuração '{name}' é desconhecida",+ "email.change_emailaddress.subject": "Confirme seu novo e-mail",+ "email.change_emailaddress.request": "Você solicitou a troca de seu email {oldEmail} para {newEmail}.",+ "email.subscription.view": "visualizar no seu navegador",+ "email.subscription.change": "alterar suas preferências de notificação",+ "email.subscription.unsubscribe": "desinscrever-se desta postagem",+ "email.greetings": "Olá!",+ "email.greetings_name": "Olá, {name}!",+ "email.operation_confirmation": "Clique no link abaixo para confirmar esta operação.",+ "email.expire_note_hours": "Importante: Este link é valido por {hours} horas e só pode ser utilizado uma vez.",+ "email.expire_note_minutes": "Importante: Este link é valido por {minutes} minutos e só pode ser utilizado uma vez.",+ "email.footer.noreply": "Este email foi enviado de uma caixa postal que não pode receber e-mails. Favor não responder este e-mail.",+ "email.change_status.duplicate": "<strong>{title} ({postLink})</strong> foi fechado como um <strong>duplicado</strong> de {duplicate}.",+ "email.change_status.others": "O status de <strong>{title} ({postLink})</strong> foi alterado para <strong>{status}</strong>.",+ "email.delete_post.text": "<strong>{title}</strong> foi <strong>removido</strong>.",+ "email.new_comment.text": "<strong>{userName}</strong> deixou um comentário em <strong>{title} ({postLink})</strong>.",+ "email.new_post.text": "<strong>{userName}</strong> criou uma nova postagem <strong>{title} ({postLink})</strong>.",+ "email.signin_email.subject": "Seu link de acesso a {siteName}",+ "email.signin_email.text": "Você solicitou um link para login e aqui está.",+ "email.signin_email.confirmation": "Clique no link abaixo para fazer login em <strong>{siteName}</strong>.",+ "email.signup_email.subject": "Seu novo site no Fider",+ "email.signup_email.text": "Você está a um passo de ativar o seu site no Fider",+ "email.signup_email.confirmation": "Através do link abaixo você irá verificar o seu e-mail e completar o processo de ativação.",+ "email.footer.subscription_notice": "Você está recebendo este e-mail porque se inscreveu nesta postagem. Você pode {view}, {unsubscribe} ou {change}.",+ "email.footer.subscription_notice2": "Você está recebendo este e-mail porque se inscreveu nesta postagem. Você pode {change}.",+ "email.footer.subscription_notice3": "Você está recebendo este e-mail porque se inscreveu nesta postagem. Você pode {view} ou {change}."}diff --git a/views/403.html b/views/403.htmlindex 614ae1fc5..d49c88bcd 100644--- a/views/403.html+++ b/views/403.html@@ -1,15 +1,19 @@-{{define "server-data"}}{{end}} {{define "content"}}+{{define "server-data"}}{{end}}++{{define "content"}}<div class="container page"><div class="w-max-7xl mx-auto text-center mt-8"><div class="h-20 mb-4"><img src="{{ .private.logo }}" /></div>- <h1 class="text-display">NOT AUTHORIZED</h1>- <p>You are not authorized to view this page.</p>+ <h1 class="text-display">{{ "error.unauthorized.title" | translate | upper }}</h1>+ <p>{{ "error.unauthorized.text" | translate }}</p>{{ if .public.tenant }}- <span>Take me back to <a class="text-link" href="{{ .public.settings.baseURL }}">{{ .public.settings.baseURL }}</a> home page.</span>+ <span>{{ translate "page.backhome" (dict "className" "text-link" "url" .public.settings.baseURL) | html }}</span>{{ end }}</div></div>-{{end}} {{define "end-of-body"}}{{end}}+{{end}}++{{define "end-of-body"}}{{end}}diff --git a/views/404.html b/views/404.htmlindex 85297083a..0b368aaf0 100644--- a/views/404.html+++ b/views/404.html@@ -1,18 +1,19 @@-{{define "server-data"}}{{end}} {{define "content"}}+{{define "server-data"}}{{end}}++{{define "content"}}<div class="container page"><div class="w-max-7xl mx-auto text-center mt-8"><div class="h-20 mb-4"><img src="{{ .private.logo }}" /></div><h1 class="text-display">{{ "error.pagenotfound.title" | translate | upper }}</h1>- <p>- The link you clicked may be broken or <br />- the page may have been removed.- </p>+ <p>{{ "error.pagenotfound.text" | translate }}</p>{{ if .public.tenant }}- <span>{{ translate "error.backhome" (dict "className" "text-link" "url" .public.settings.baseURL) | html }}</span>+ <span>{{ translate "page.backhome" (dict "className" "text-link" "url" .public.settings.baseURL) | html }}</span>{{ end }}</div></div>-{{end}} {{define "end-of-body"}}{{end}}+{{end}}++{{define "end-of-body"}}{{end}}diff --git a/views/410.html b/views/410.htmlindex f3f036419..975d7af21 100644--- a/views/410.html+++ b/views/410.html@@ -1,15 +1,19 @@-{{define "server-data"}}{{end}} {{define "content"}}+{{define "server-data"}}{{end}}++{{define "content"}}<div class="container page"><div class="w-max-7xl mx-auto text-center mt-8"><div class="h-20 mb-4"><img src="{{ .private.logo }}" /></div>- <h1 class="text-display">EXPIRED</h1>- <p>The link you clicked has expired.</p>+ <h1 class="text-display">{{ "error.expired.title" | translate | upper }}</h1>+ <p>{{ "error.expired.text" | translate }}</p>{{ if .public.tenant }}- <span>Take me back to <a class="text-link" href="{{ .public.settings.baseURL }}">{{ .public.settings.baseURL }}</a> home page.</span>+ <span>{{ translate "page.backhome" (dict "className" "text-link" "url" .public.settings.baseURL) | html }}</span>{{ end }}</div></div>-{{end}} {{define "end-of-body"}}{{end}}+{{end}}++{{define "end-of-body"}}{{end}}diff --git a/views/500.html b/views/500.htmlindex 7a5732cee..8b9a7c224 100644--- a/views/500.html+++ b/views/500.html@@ -1,19 +1,19 @@{{define "server-data"}}{{end}}{{define "content"}}- <div class="container page">- <div class="w-max-7xl mx-auto text-center mt-8">- <div class="h-20 mb-4">- <img src="{{ .private.logo }}"/>- </div>- <h1 class="text-display">Shoot! Well, this is unexpected…</h1>- <p>An error has occurred and we're working to fix the problem! </br> We’ll be up and running shortly.</p>-- {{ if .public.tenant }}- <span>Take me back to <a class="text-link" href="{{ .public.settings.baseURL }}">{{ .public.settings.baseURL }}</a> home page.</span>- {{ end }}+<div class="container page">+ <div class="w-max-7xl mx-auto text-center mt-8">+ <div class="h-20 mb-4">+ <img src="{{ .private.logo }}"/></div>+ <h1 class="text-display">{{ "error.internalerror.title" | translate | upper }}</h1>+ <p>{{ "error.internalerror.text" | translate }}</p>++ {{ if .public.tenant }}+ <span>{{ translate "page.backhome" (dict "className" "text-link" "url" .public.settings.baseURL) | html }}</span>+ {{ end }}</div>+</div>{{end}}{{define "end-of-body"}}{{end}}\ No newline at end of filediff --git a/views/templates/base_email.tpl b/views/email/base_email.htmlsimilarity index 93%rename from views/templates/base_email.tplrename to views/email/base_email.htmlindex b67536e58..adc1ab537 100644--- a/views/templates/base_email.tpl+++ b/views/email/base_email.html@@ -1,3 +1,5 @@+subject: {{block "subject" .}}{{end}}+body:<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head>@@ -23,7 +25,7 @@<tr><td align="center"><table bgcolor="#FFFFFF" cellpadding="0" cellspacing="0" border="0" style="text-align:left;padding:20px;margin:10px;border-radius:5px;color:#1c262d;border:1px solid #ECECEC;min-width:320px;max-width:660px;">- {{ .body }}+ {{block "body" .}}{{end}}</table></td></tr>diff --git a/views/email/change_emailaddress_email.html b/views/email/change_emailaddress_email.htmlnew file mode 100644index 000000000..1bee1df8b--- /dev/null+++ b/views/email/change_emailaddress_email.html@@ -0,0 +1,13 @@+{{define "subject"}}{{ "email.change_emailaddress.subject" | translate }}{{end}}++{{define "body"}}+<tr>+ <td>+ <h2 style="color:#1c262d">{{ translate "email.greetings_name" (dict "name" .name) }}</h2>+ <p style="color:#1c262d">{{ translate "email.change_emailaddress.request" (dict "oldEmail" .oldEmail "newEmail" .newEmail) }}</p>+ <p style="color:#1c262d">{{ "email.operation_confirmation" | translate }}</p>+ <p>{{ .link | html }}</p>+ <p style="color:#666;font-size:14px">{{ translate "email.expire_note_hours" (dict "hours" 24) }}</p>+ </td>+</tr>+{{end}}\ No newline at end of filediff --git a/views/email/change_status.html b/views/email/change_status.htmlnew file mode 100644index 000000000..391dfb946--- /dev/null+++ b/views/email/change_status.html@@ -0,0 +1,21 @@+{{define "subject"}}[{{ .siteName }}] {{ .title }}{{end}}++{{define "body"}}+<tr>+ <td>+ <p style="padding-bottom:10px;border-bottom:1px solid #efefef;color:#1c262d">+ {{ if .duplicate }}+ {{ translate "email.change_status.duplicate" (dict "title" (.title | stripHtml) "postLink" .postLink "duplicate" .duplicate) | html }}+ {{ else }}+ {{ translate "email.change_status.others" (dict "title" (.title | stripHtml) "postLink" .postLink "status" (.status | lower)) | html }}+ {{ end }}+ </p>+ {{ .content }}+ <p style="color:#666;font-size:14px">+ — <br />+ {{ translate "email.footer.subscription_notice" (dict "view" .view "unsubscribe" .unsubscribe "change" .change) | html }}+ </p>+ </td>+</tr>+{{end}}+diff --git a/views/email/delete_post.html b/views/email/delete_post.htmlnew file mode 100644index 000000000..eef038826--- /dev/null+++ b/views/email/delete_post.html@@ -0,0 +1,16 @@+{{define "subject"}}[{{ .siteName }}] {{ .title }}{{end}}++{{define "body"}}+<tr>+ <td>+ <p style="padding-bottom:10px;border-bottom:1px solid #efefef;color:#1c262d">+ {{ translate "email.delete_post.text" (dict "title" (.title | stripHtml)) | html }}+ </p>+ {{ .content }}+ <p style="color:#666;font-size:14px">+ — <br />+ {{ translate "email.footer.subscription_notice2" (dict "change" .change) | html }}+ </p>+ </td>+</tr>+{{end}}\ No newline at end of filediff --git a/views/email/echo_test.html b/views/email/echo_test.htmlnew file mode 100644index 000000000..218319812--- /dev/null+++ b/views/email/echo_test.html@@ -0,0 +1,5 @@+{{define "subject"}}Message to: {{ .name }}{{end}}++{{define "body"}}+Hello World {{ .name }}!+{{end}}\ No newline at end of filediff --git a/views/email/invite_email.html b/views/email/invite_email.htmlnew file mode 100644index 000000000..63e33ccf0--- /dev/null+++ b/views/email/invite_email.html@@ -0,0 +1,7 @@+{{define "subject"}}{{ .subject }}{{end}}++{{define "body"}}+<tr>+ <td>{{ .message }}</td>+</tr>+{{end}}\ No newline at end of filediff --git a/views/email/new_comment.html b/views/email/new_comment.htmlnew file mode 100644index 000000000..aa96adc33--- /dev/null+++ b/views/email/new_comment.html@@ -0,0 +1,16 @@+{{define "subject"}}[{{ .siteName }}] {{ .title }}{{end}}++{{define "body"}}+<tr>+ <td>+ <p style="padding-bottom:10px;border-bottom:1px solid #efefef;color:#1c262d">+ {{ translate "email.new_comment.text" (dict "userName" .userName "title" (.title | stripHtml) "postLink" .postLink) | html }}+ </p>+ {{ .content }}+ <p style="color:#666;font-size:14px">+ — <br />+ {{ translate "email.footer.subscription_notice" (dict "view" .view "unsubscribe" .unsubscribe "change" .change) | html }}+ </p>+ </td>+</tr>+{{end}}\ No newline at end of filediff --git a/views/email/new_post.html b/views/email/new_post.htmlnew file mode 100644index 000000000..788609030--- /dev/null+++ b/views/email/new_post.html@@ -0,0 +1,16 @@+{{define "subject"}}[{{ .siteName }}] {{ .title }}{{end}}++{{define "body"}}+<tr>+ <td>+ <p style="padding-bottom:10px;border-bottom:1px solid #efefef;color:#1c262d">+ {{ translate "email.new_post.text" (dict "userName" (.userName | stripHtml) "title" (.title | stripHtml) "postLink" .postLink) | html }}+ </p>+ {{ .content }}+ <p style="color:#666;font-size:14px">+ — <br />+ {{ translate "email.footer.subscription_notice3" (dict "view" .view "change" .change) | html }}+ </p>+ </td>+</tr>+{{end}}\ No newline at end of filediff --git a/views/email/signin_email.html b/views/email/signin_email.htmlnew file mode 100644index 000000000..1c45738c2--- /dev/null+++ b/views/email/signin_email.html@@ -0,0 +1,13 @@+{{define "subject"}}{{ translate "email.signin_email.subject" (dict "siteName" .siteName) }}{{end}}++{{define "body"}}+<tr>+ <td>+ <h2 style="color:#1c262d">{{ "email.greetings" | translate }}</h2>+ <p style="color:#1c262d">{{ "email.signin_email.text" | translate }}</p>+ <p style="color:#1c262d">{{ translate "email.signin_email.confirmation" (dict "siteName" (.siteName | stripHtml)) | html }}</p>+ <p>{{ .link | html }}</p>+ <p style="color:#666;font-size:14px">{{ translate "email.expire_note_minutes" (dict "minutes" 30) }}</p>+ </td>+</tr>+{{end}}\ No newline at end of filediff --git a/views/email/signup_email.html b/views/email/signup_email.htmlnew file mode 100644index 000000000..a94d395d5--- /dev/null+++ b/views/email/signup_email.html@@ -0,0 +1,13 @@+{{define "subject"}}{{ "email.signup_email.subject" | translate }}{{end}}++{{define "body"}}+<tr>+ <td>+ <h2 style="color:#1c262d">{{ "email.greetings" | translate }}</h2>+ <p style="color:#1c262d">{{ "email.signup_email.text" | translate }}</p>+ <p style="color:#1c262d">{{ "email.signup_email.confirmation" | translate }}</p>+ <p>{{ .link | html }}</p>+ <p style="color:#666;font-size:14px">{{ translate "email.expire_note_hours" (dict "hours" 48) }}</p>+ </td>+</tr>+{{end}}\ No newline at end of filediff --git a/views/maintenance.html b/views/maintenance.htmlindex 923ab0983..3dd1ac9a5 100644--- a/views/maintenance.html+++ b/views/maintenance.html@@ -1,4 +1,6 @@-{{define "server-data"}}{{end}} {{define "content"}}+{{define "server-data"}}{{end}}++å{{define "content"}}<div class="container page"><div class="w-max-7xl mx-auto text-center mt-8"><div class="h-20 mb-4">@@ -14,4 +16,6 @@{{ end }}</div></div>-{{end}} {{define "end-of-body"}}{{end}}+{{end}}++{{define "end-of-body"}}{{end}}diff --git a/views/not-invited.html b/views/not-invited.htmlindex 58c8f8ec5..e45b88d5c 100644--- a/views/not-invited.html+++ b/views/not-invited.html@@ -4,11 +4,11 @@<div class="h-20 mb-4"><img src="{{ .private.logo }}" /></div>- <h1 class="text-display">NOT INVITED</h1>- <p>We couldn't find your account for your email address.</p>+ <h1 class="text-display">{{ "page.notinvited.title" | translate | upper }}</h1>+ <p>{{ "page.notinvited.text" | translate }}</p>{{ if .public.tenant }}- <span>Take me back to <a class="text-link" href="{{ .public.settings.baseURL }}/signin">{{ .public.settings.baseURL }}/signin</a>.</span>+ <span>{{ translate "page.backhome" (dict "className" "text-link" "url" .public.settings.baseURL) | html }}</span>{{ end }}</div></div>diff --git a/views/pending-activation.html b/views/pending-activation.htmlindex 806b5b640..c9b4a6e62 100644--- a/views/pending-activation.html+++ b/views/pending-activation.html@@ -4,9 +4,9 @@<div class="h-20 mb-4"><img src="{{ .private.logo }}" /></div>- <h1 class="text-display">YOUR ACCOUNT IS PENDING ACTIVATION</h1>- <p>We sent you a confirmation email with a link to activate your site.</p>- <p>Please check your inbox to activate it.</p>+ <h1 class="text-display">{{ "page.pendingactivation.title" | translate | upper }}</h1>+ <p>{{ "page.pendingactivation.text" | translate }}</p>+ <p>{{ "page.pendingactivation.text2" | translate }}</p></div></div>{{end}} {{define "end-of-body"}}{{end}}diff --git a/views/templates/change_emailaddress_email.tpl b/views/templates/change_emailaddress_email.tpldeleted file mode 100644index 920916b72..000000000--- a/views/templates/change_emailaddress_email.tpl+++ /dev/null@@ -1,11 +0,0 @@-subject: Confirm your new email-body:-<tr>- <td>- <h2 style="color:#1c262d">Hello, {{ .name }}!</h2>- <p style="color:#1c262d">You have requested to change your email from {{ .oldEmail }} to {{ .newEmail }}.</p>- <p style="color:#1c262d">Click the link below to confirm this operation.</p>- <p>{{ .link }}</p>- <p style="color:#666;font-size:14px">Note: This link will expire in 24 hours and can only be used one time.</p>- </td>-</tr>\ No newline at end of filediff --git a/views/templates/change_status.tpl b/views/templates/change_status.tpldeleted file mode 100644index 46ec72c9a..000000000--- a/views/templates/change_status.tpl+++ /dev/null@@ -1,18 +0,0 @@-subject: [{{ .tenantName }}] {{ .title }}-body:-<tr>- <td>- <p style="padding-bottom:10px;border-bottom:1px solid #efefef;color:#1c262d">- {{ if .duplicate }}- <strong>{{ .title }} ({{ .postLink }})</strong> has been closed as a <strong>{{ .status }}</strong> of {{ .duplicate }}.- {{ else }}- Status of <strong>{{ .title }} ({{ .postLink }})</strong> has changed to <strong>{{ .status }}</strong>.- {{ end }}- </p>- {{ .content }}- <p style="color:#666;font-size:14px">- — <br />- You are receiving this email because you are subscribed to this post. You can {{ .view }}, {{ .unsubscribe }} or {{ .change }}.- </p>- </td>-</tr>\ No newline at end of filediff --git a/views/templates/delete_post.tpl b/views/templates/delete_post.tpldeleted file mode 100644index 3ffe25918..000000000--- a/views/templates/delete_post.tpl+++ /dev/null@@ -1,14 +0,0 @@-subject: [{{ .tenantName }}] {{ .title }}-body:-<tr>- <td>- <p style="padding-bottom:10px;border-bottom:1px solid #efefef;color:#1c262d">- <strong>{{ .title }}</strong> has been <strong>deleted</strong>.- </p>- {{ .content }}- <p style="color:#666;font-size:14px">- — <br />- You are receiving this email because you are subscribed to this post. You can {{ .change }}.- </p>- </td>-</tr>\ No newline at end of filediff --git a/views/templates/echo_test.tpl b/views/templates/echo_test.tpldeleted file mode 100644index 4b7c2f263..000000000--- a/views/templates/echo_test.tpl+++ /dev/null@@ -1,3 +0,0 @@-subject: Message to: {{ .name }}-body:-Hello World {{ .name }}!\ No newline at end of filediff --git a/views/templates/invite_email.tpl b/views/templates/invite_email.tpldeleted file mode 100644index 3cbe652e8..000000000--- a/views/templates/invite_email.tpl+++ /dev/null@@ -1,5 +0,0 @@-subject: {{ .subject }}-body:-<tr>- <td>{{ .message }}</td>-</tr>\ No newline at end of filediff --git a/views/templates/new_comment.tpl b/views/templates/new_comment.tpldeleted file mode 100644index 2814d3cc1..000000000--- a/views/templates/new_comment.tpl+++ /dev/null@@ -1,14 +0,0 @@-subject: [{{ .tenantName }}] {{ .title }}-body:-<tr>- <td>- <p style="padding-bottom:10px;border-bottom:1px solid #efefef;color:#1c262d">- <strong>{{ .userName }}</strong> left a comment on <strong>{{ .title }} ({{ .postLink }})</strong>- </p>- {{ .content }}- <p style="color:#666;font-size:14px">- — <br />- You are receiving this email because you are subscribed to this post. You can {{ .view }}, {{ .unsubscribe }} or {{ .change }}.- </p>- </td>-</tr>\ No newline at end of filediff --git a/views/templates/new_post.tpl b/views/templates/new_post.tpldeleted file mode 100644index 48c6d1a42..000000000--- a/views/templates/new_post.tpl+++ /dev/null@@ -1,14 +0,0 @@-subject: [{{ .tenantName }}] {{ .title }}-body:-<tr>- <td>- <p style="padding-bottom:10px;border-bottom:1px solid #efefef;color:#1c262d">- <strong>{{ .userName }}</strong> created a new post <strong>{{ .title }} ({{ .postLink }})</strong>.- </p>- {{ .content }}- <p style="color:#666;font-size:14px">- — <br />- You are receiving this email because you are subscribed to this site. You can {{ .view }} or {{ .change }}.- </p>- </td>-</tr>\ No newline at end of filediff --git a/views/templates/signin_email.tpl b/views/templates/signin_email.tpldeleted file mode 100644index f4a764988..000000000--- a/views/templates/signin_email.tpl+++ /dev/null@@ -1,11 +0,0 @@-subject: Sign in to {{ .tenantName }}-body:-<tr>- <td>- <h2 style="color:#1c262d">Hello!</h2>- <p style="color:#1c262d">You asked us to send you a sign-in link and here it is.</p>- <p style="color:#1c262d">Click the link below to sign in to <strong>{{ .tenantName }}</strong>.</p>- <p>{{ .link }}</p>- <p style="color:#666;font-size:14px">Note: This link will expire in 30 minutes and can only be used one time.</p>- </td>-</tr>\ No newline at end of filediff --git a/views/templates/signup_email.tpl b/views/templates/signup_email.tpldeleted file mode 100644index b4d4613a2..000000000--- a/views/templates/signup_email.tpl+++ /dev/null@@ -1,11 +0,0 @@-subject: Your new Fider site-body:-<tr>- <td>- <h2 style="color:#1c262d">Hello!</h2>- <p style="color:#1c262d">You are one step away from activating your Fider site.</p>- <p style="color:#1c262d">Through the link below you can verify your email address and complete the activation process.</p>- <p>{{ .link }}</p>- <p style="color:#666;font-size:14px">Note: This link will expire in 48 hours and can only be used one time.</p>- </td>-</tr>\ No newline at end of file