mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-05-12 22:10:25 +00:00
[v15.0/forgejo] i18n(mailer): Fix special usage of .Locale in admin_new_user (#12112)
**Backport:** https://codeberg.org/forgejo/forgejo/pulls/12009 This PR is in reaction to https://codeberg.org/forgejo/forgejo/issues/1711 . Co-authored-by: Έλλεν Εμίλια Άννα Zscheile <fogti+devel@ytrizja.de> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/12112 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org> Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
This commit is contained in:
parent
c8156fbc60
commit
36bf4722a2
3 changed files with 8 additions and 4 deletions
|
|
@ -60,9 +60,13 @@ func (handler Handler) handleTemplateNode(fset *token.FileSet, node tmplParser.N
|
||||||
|
|
||||||
case tmplParser.NodeField:
|
case tmplParser.NodeField:
|
||||||
nodeField := nodeCommand.Args[0].(*tmplParser.FieldNode)
|
nodeField := nodeCommand.Args[0].(*tmplParser.FieldNode)
|
||||||
if len(nodeField.Ident) != 2 || !(nodeField.Ident[0] == "locale" || nodeField.Ident[0] == "Locale") {
|
if len(nodeField.Ident) != 2 || nodeField.Ident[0] != "locale" {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
resolvedPos := fset.PositionFor(token.Pos(nodeCommand.Pos), false)
|
||||||
|
if !strings.Contains(resolvedPos.Filename, "templates/mail/") {
|
||||||
|
handler.OnWarning(fset, token.Pos(nodeCommand.Pos), "encountered unexpected .locale usage")
|
||||||
|
}
|
||||||
funcname = nodeField.Ident[1]
|
funcname = nodeField.Ident[1]
|
||||||
|
|
||||||
case tmplParser.NodeVariable:
|
case tmplParser.NodeVariable:
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ func mailNewUser(_ context.Context, u *user_model.User, lang string, tos []strin
|
||||||
"Subject": subject,
|
"Subject": subject,
|
||||||
"Body": body,
|
"Body": body,
|
||||||
"Language": locale.Language(),
|
"Language": locale.Language(),
|
||||||
"Locale": locale,
|
"locale": locale,
|
||||||
"SanitizeHTML": templates.SanitizeHTML,
|
"SanitizeHTML": templates.SanitizeHTML,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,8 @@
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<ul>
|
<ul>
|
||||||
<h3>{{.Locale.Tr "mail.admin.new_user.user_info"}}: <a href="{{.NewUserUrl}}">@{{.NewUser.Name}}</a></h3>
|
<h3>{{.locale.Tr "mail.admin.new_user.user_info"}}: <a href="{{.NewUserUrl}}">@{{.NewUser.Name}}</a></h3>
|
||||||
<li>{{.Locale.Tr "admin.users.created"}}: {{DateTime "full" .NewUser.CreatedUnix}}</li>
|
<li>{{.locale.Tr "admin.users.created"}}: {{DateTime "full" .NewUser.CreatedUnix}}</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p> {{.Body | SanitizeHTML}} </p>
|
<p> {{.Body | SanitizeHTML}} </p>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue