Skip to content

Commit 5f5e3b3

Browse files
committed
Merge branch 'master' into fix-8952
2 parents d5a2cd1 + 9930d47 commit 5f5e3b3

File tree

25 files changed

+308
-289
lines changed

25 files changed

+308
-289
lines changed

docs/content/doc/advanced/mail-templates-us.md

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ Currently, the following notification events make use of templates:
3232
| `close` | An issue or pull request was closed. |
3333
| `reopen` | An issue or pull request was reopened. |
3434
| `review` | The head comment of a review in a pull request. |
35+
| `approve` | The head comment of a approving review for a pull request. |
36+
| `reject` | The head comment of a review requesting changes for a pull request. |
3537
| `code` | A single comment on the code of a pull request. |
3638
| `assigned` | Used was assigned to an issue or pull request. |
3739
| `default` | Any action not included in the above categories, or when the corresponding category template is not present. |
@@ -84,22 +86,23 @@ _subject_ and _mail body_ templates requires at least three dashes; no other cha
8486
_Subject_ and _mail body_ are parsed by [Golang's template engine](https://golang.org/pkg/text/template/) and
8587
are provided with a _metadata context_ assembled for each notification. The context contains the following elements:
8688

87-
| Name | Type | Available | Usage |
88-
|--------------------|----------------|---------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
89-
| `.FallbackSubject` | string | Always | A default subject line. See Below. |
90-
| `.Subject` | string | Only in body | The _subject_, once resolved. |
91-
| `.Body` | string | Always | The message of the issue, pull request or comment, parsed from Markdown into HTML and sanitized. Do not confuse with the _mail body_ |
92-
| `.Link` | string | Always | The address of the originating issue, pull request or comment. |
93-
| `.Issue` | models.Issue | Always | The issue (or pull request) originating the notification. To get data specific to a pull request (e.g. `HasMerged`), `.Issue.PullRequest` can be used, but care should be taken as this field will be `nil` if the issue is *not* a pull request. |
94-
| `.Comment` | models.Comment | If applicable | If the notification is from a comment added to an issue or pull request, this will contain the information about the comment. |
95-
| `.IsPull` | bool | Always | `true` if the mail notification is associated with a pull request (i.e. `.Issue.PullRequest` is not `nil`). |
96-
| `.Repo` | string | Always | Name of the repository, including owner name (e.g. `mike/stuff`) |
97-
| `.User` | models.User | Always | Owner of the repository from which the event originated. To get the user name (e.g. `mike`),`.User.Name` can be used. |
98-
| `.Doer` | models.User | Always | User that executed the action triggering the notification event. To get the user name (e.g. `rhonda`), `.Doer.Name` can be used. |
99-
| `.IsMention` | bool | Always | `true` if this notification was only generated because the user was mentioned in the comment, while not being subscribed to the source. It will be `false` if the recipient was subscribed to the issue or repository. |
100-
| `.SubjectPrefix` | string | Always | `Re: ` if the notification is about other than issue or pull request creation; otherwise an empty string. |
101-
| `.ActionType` | string | Always | `"issue"` or `"pull"`. Will correspond to the actual _action type_ independently of which template was selected. |
102-
| `.ActionName` | string | Always | It will be one of the action types described above (`new`, `comment`, etc.), and will correspond to the actual _action name_ independently of which template was selected. |
89+
| Name | Type | Available | Usage |
90+
|--------------------|------------------|---------------|------------------------------------------------------------------------------------------------------------------------------------------------------|
91+
| `.FallbackSubject` | string | Always | A default subject line. See Below. |
92+
| `.Subject` | string | Only in body | The _subject_, once resolved. |
93+
| `.Body` | string | Always | The message of the issue, pull request or comment, parsed from Markdown into HTML and sanitized. Do not confuse with the _mail body_. |
94+
| `.Link` | string | Always | The address of the originating issue, pull request or comment. |
95+
| `.Issue` | models.Issue | Always | The issue (or pull request) originating the notification. To get data specific to a pull request (e.g. `HasMerged`), `.Issue.PullRequest` can be used, but care should be taken as this field will be `nil` if the issue is *not* a pull request. |
96+
| `.Comment` | models.Comment | If applicable | If the notification is from a comment added to an issue or pull request, this will contain the information about the comment. |
97+
| `.IsPull` | bool | Always | `true` if the mail notification is associated with a pull request (i.e. `.Issue.PullRequest` is not `nil`). |
98+
| `.Repo` | string | Always | Name of the repository, including owner name (e.g. `mike/stuff`) |
99+
| `.User` | models.User | Always | Owner of the repository from which the event originated. To get the user name (e.g. `mike`),`.User.Name` can be used. |
100+
| `.Doer` | models.User | Always | User that executed the action triggering the notification event. To get the user name (e.g. `rhonda`), `.Doer.Name` can be used. |
101+
| `.IsMention` | bool | Always | `true` if this notification was only generated because the user was mentioned in the comment, while not being subscribed to the source. It will be `false` if the recipient was subscribed to the issue or repository. |
102+
| `.SubjectPrefix` | string | Always | `Re: ` if the notification is about other than issue or pull request creation; otherwise an empty string. |
103+
| `.ActionType` | string | Always | `"issue"` or `"pull"`. Will correspond to the actual _action type_ independently of which template was selected. |
104+
| `.ActionName` | string | Always | It will be one of the action types described above (`new`, `comment`, etc.), and will correspond to the actual _action name_ independently of which template was selected. |
105+
| `.ReviewComments` | []models.Comment | Always | List of code comments in a review. The comment text will be in `.RenderedContent` and the referenced code will be in `.Patch`. |
103106

104107
All names are case sensitive.
105108

@@ -254,13 +257,14 @@ This template produces something along these lines:
254257
The template system contains several functions that can be used to further process and format
255258
the messages. Here's a list of some of them:
256259

257-
| Name | Parameters | Available | Usage |
258-
|----------------------|-------------|-----------|---------------------------------------------------------------------|
259-
| `AppUrl` | - | Any | Gitea's URL |
260-
| `AppName` | - | Any | Set from `app.ini`, usually "Gitea" |
261-
| `AppDomain` | - | Any | Gitea's host name |
262-
| `EllipsisString` | string, int | Any | Truncates a string to the specified length; adds ellipsis as needed |
263-
| `Str2html` | string | Body only | Sanitizes text by removing any HTML tags from it. |
260+
| Name | Parameters | Available | Usage |
261+
|----------------------|-------------|-----------|------------------------------------------------------------------------------|
262+
| `AppUrl` | - | Any | Gitea's URL |
263+
| `AppName` | - | Any | Set from `app.ini`, usually "Gitea" |
264+
| `AppDomain` | - | Any | Gitea's host name |
265+
| `EllipsisString` | string, int | Any | Truncates a string to the specified length; adds ellipsis as needed |
266+
| `Str2html` | string | Body only | Sanitizes text by removing any HTML tags from it. |
267+
| `Safe` | string | Body only | Takes the input as HTML; can be used for `.ReviewComments.RenderedContent`. |
264268

265269
These are _functions_, not metadata, so they have to be used:
266270

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ require (
8080
github.com/prometheus/client_golang v1.1.0
8181
github.com/prometheus/procfs v0.0.4 // indirect
8282
github.com/remyoudompheng/bigfft v0.0.0-20190321074620-2f0d2b0e0001 // indirect
83-
github.com/russross/blackfriday v2.0.0+incompatible // indirect
8483
github.com/russross/blackfriday/v2 v2.0.1
8584
github.com/saintfish/chardet v0.0.0-20120816061221-3af4cd4741ca // indirect
8685
github.com/satori/go.uuid v1.2.0

0 commit comments

Comments
 (0)