diff options
author | guillep2k <18600385+guillep2k@users.noreply.github.com> | 2019-11-07 10:34:28 -0300 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2019-11-07 21:34:28 +0800 |
commit | 1f90147f3942065e2a7f564e8a3c97d23d41e6c0 (patch) | |
tree | fd5fb0bda2d84deb179bf99f9172b28f736ba9fe /templates/mail | |
parent | d5b1e6bc51f87eb1be07a4682798428bf4bbb9ce (diff) | |
download | gitea-1f90147f3942065e2a7f564e8a3c97d23d41e6c0.tar.gz gitea-1f90147f3942065e2a7f564e8a3c97d23d41e6c0.zip |
Use templates for issue e-mail subject and body (#8329)
* Add template capability for issue mail subject
* Remove test string
* Fix trim subject length
* Add comment to template and run make fmt
* Add information for the template
* Rename defaultMailSubject() to fallbackMailSubject()
* General rewrite of the mail template code
* Fix .Doer name
* Use text/template for subject instead of html
* Fix subject Re: prefix
* Fix mail tests
* Fix static templates
* [skip ci] Updated translations via Crowdin
* Expose db.SetMaxOpenConns and allow non MySQL dbs to set conn pool params (#8528)
* Expose db.SetMaxOpenConns and allow other dbs to set their connection params
* Add note about port exhaustion
Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>
* Prevent .code-view from overriding font on icon fonts (#8614)
* Correct some outdated statements in the contributing guidelines (#8612)
* More information for drone-cli in CONTRIBUTING.md
* Increases the version of drone-cli to 1.2.0
* Adds a note for the Docker Toolbox on Windows
Signed-off-by: LukBukkit <luk.bukkit@gmail.com>
* Fix the url for the blog repository (now on gitea.com)
Signed-off-by: LukBukkit <luk.bukkit@gmail.com>
* Remove TrN due to lack of lang context
* Redo templates to match previous code
* Fix extra character in template
* Unify PR & Issue tempaltes, fix format
* Remove default subject
* Add template tests
* Fix template
* Remove replaced function
* Provide User as models.User for better consistency
* Add docs
* Fix doc inaccuracies, improve examples
* Change mail footer to math AppName
* Add test for mail subject/body template separation
* Add support for code review comments
* Update docs/content/doc/advanced/mail-templates-us.md
Co-Authored-By: 6543 <24977596+6543@users.noreply.github.com>
Diffstat (limited to 'templates/mail')
-rw-r--r-- | templates/mail/issue/assigned.tmpl | 4 | ||||
-rw-r--r-- | templates/mail/issue/comment.tmpl | 16 | ||||
-rw-r--r-- | templates/mail/issue/default.tmpl | 31 | ||||
-rw-r--r-- | templates/mail/issue/mention.tmpl | 17 |
4 files changed, 33 insertions, 35 deletions
diff --git a/templates/mail/issue/assigned.tmpl b/templates/mail/issue/assigned.tmpl index ab06ade1f4..997e2447fc 100644 --- a/templates/mail/issue/assigned.tmpl +++ b/templates/mail/issue/assigned.tmpl @@ -6,11 +6,11 @@ </head> <body> - <p>@{{.Doer.Name}} assigned you to the {{if eq .Issue.IsPull true}}pull request{{else}}issue{{end}} <a href="{{.Link}}">#{{.Issue.Index}}</a> in repository {{.Issue.Repo.FullName}}.</p> + <p>@{{.Doer.Name}} assigned you to the {{if .IsPull}}pull request{{else}}issue{{end}} <a href="{{.Link}}">#{{.Issue.Index}}</a> in repository {{.Repo}}.</p> <p> --- <br> - <a href="{{.Link}}">View it on Gitea</a>. + <a href="{{.Link}}">View it on {{AppName}}</a>. </p> </body> diff --git a/templates/mail/issue/comment.tmpl b/templates/mail/issue/comment.tmpl deleted file mode 100644 index cc86addaf0..0000000000 --- a/templates/mail/issue/comment.tmpl +++ /dev/null @@ -1,16 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <title>{{.Subject}}</title> -</head> - -<body> - <p>{{.Body | Str2html}}</p> - <p> - --- - <br> - <a href="{{.Link}}">View it on Gitea</a>. - </p> -</body> -</html> diff --git a/templates/mail/issue/default.tmpl b/templates/mail/issue/default.tmpl new file mode 100644 index 0000000000..ee15d6d8e1 --- /dev/null +++ b/templates/mail/issue/default.tmpl @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <title>{{.Subject}}</title> +</head> + +<body> + {{if .IsMention}}<p>@{{.Doer.Name}} mentioned you:</p>{{end}} + <p> + {{- if eq .Body ""}} + {{if eq .ActionName "new"}} + Created #{{.Issue.Index}}. + {{else if eq .ActionName "close"}} + Closed #{{.Issue.Index}}. + {{else if eq .ActionName "reopen"}} + Reopened #{{.Issue.Index}}. + {{else}} + Empty comment on #{{.Issue.Index}}. + {{end}} + {{else}} + {{.Body | Str2html}} + {{end -}} + </p> + <p> + --- + <br> + <a href="{{.Link}}">View it on {{AppName}}</a>. + </p> +</body> +</html> diff --git a/templates/mail/issue/mention.tmpl b/templates/mail/issue/mention.tmpl deleted file mode 100644 index 032eea053d..0000000000 --- a/templates/mail/issue/mention.tmpl +++ /dev/null @@ -1,17 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <title>{{.Subject}}</title> -</head> - -<body> - <p>@{{.Doer.Name}} mentioned you:</p> - <p>{{.Body | Str2html}}</p> - <p> - --- - <br> - <a href="{{.Link}}">View it on Gitea</a>. - </p> -</body> -</html> |