blob: 1adc8d976452cf6c814eb390296fcdc7052c4c54 [file] [log] [blame]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001= Gerrit Code Review - Mail Templates
Martin Fickb7f3b2d2010-07-23 10:23:03 -06002
David Pursehouse98b60032017-04-04 15:19:59 +09003Gerrit uses link:https://developers.google.com/closure/templates/[Closure Templates]
4(Soy) for the bulk of the standard mails it sends out.
Martin Fickb7f3b2d2010-07-23 10:23:03 -06005There are builtin default templates which are used if they are not overridden.
6These defaults are also provided as examples so that administrators may copy
7them and easily modify them to tweak their contents.
8
Wyatt Allenbf0502c2016-10-18 13:47:43 -07009*Compatibility Note:* previously, Velocity Template Language (VTL) was used as
10the template language for Gerrit emails. VTL has now been deprecated in favor of
11Soy, but Velocity templates that modify text emails remain supported for now.
Martin Fickb7f3b2d2010-07-23 10:23:03 -060012
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080013== Template Locations and Extensions:
Martin Fickb7f3b2d2010-07-23 10:23:03 -060014
15The default example templates reside under: `'$site_path'/etc/mail` and are
Wyatt Allenbf0502c2016-10-18 13:47:43 -070016terminated with the double extension `.soy.example`. Modifying these example
Martin Fickb7f3b2d2010-07-23 10:23:03 -060017files will have no effect on the behavior of Gerrit. However, copying an
18example template to an equivalently named file without the `.example` extension
19and modifying it will allow an administrator to customize the template.
20
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080021== Supported Mail Templates:
Martin Fickb7f3b2d2010-07-23 10:23:03 -060022
David Pursehouse221d4f62012-06-08 17:38:08 +090023Each mail that Gerrit sends out is controlled by at least one template. These
Martin Fickb7f3b2d2010-07-23 10:23:03 -060024are listed below. Change emails are influenced by two additional templates,
25one to set the subject line, and one to set the footer which gets appended to
Wyatt Allenbf0502c2016-10-18 13:47:43 -070026all the change emails (see `ChangeSubject.soy` and `ChangeFooter.soy` below.)
Martin Fickb7f3b2d2010-07-23 10:23:03 -060027
Wyatt Allenbf0502c2016-10-18 13:47:43 -070028Many types of Gerrit email message support HTML in addition to plain-text. Where
29both are supported, templates to control the HTML part have `...Html` appended
30in their file names. For example, for "Abandoned" emails, the `Abandoned.soy`
31template determines the text part of the message, whereas `AbandonedHtml.soy`
32determines the HTML part.
Martin Fick40ed99f2010-07-21 11:46:21 -060033
Wyatt Allenbf0502c2016-10-18 13:47:43 -070034=== Abandoned.soy and AbandonedHtml.soy
Martin Fick40ed99f2010-07-21 11:46:21 -060035
Wyatt Allenbf0502c2016-10-18 13:47:43 -070036The "Abandoned" templates will determine the contents of the email related to a
37change being abandoned. It is a `ChangeEmail`: see `ChangeSubject.soy` and
38ChangeFooter.
Doug Kelly251b1572015-08-25 11:02:04 -050039
Wyatt Allenbf0502c2016-10-18 13:47:43 -070040=== AddKey.soy and AddKeyHtml.soy
Doug Kelly251b1572015-08-25 11:02:04 -050041
Wyatt Allenbf0502c2016-10-18 13:47:43 -070042AddKey templates will determine the contents of the email related to SSH and GPG
43keys being added to a user account. This notification is not sent when the key
44is administratively added to another user account.
Martin Fick82bd12c2010-07-21 11:46:21 -060045
Wyatt Allenbf0502c2016-10-18 13:47:43 -070046=== ChangeFooter.soy and ChangeFooterHtml.soy
Martin Fick82bd12c2010-07-21 11:46:21 -060047
Wyatt Allenbf0502c2016-10-18 13:47:43 -070048The ChangeFooter templates will determine the contents of the footer that will
49be appended to emails related to changes (all `ChangeEmail`s).
Martin Fickb7f3b2d2010-07-23 10:23:03 -060050
Wyatt Allenbf0502c2016-10-18 13:47:43 -070051=== ChangeSubject.soy
52
53The `ChangeSubject.soy` template will determine the contents of the email
Martin Fickb7f3b2d2010-07-23 10:23:03 -060054subject line for ALL emails related to changes.
55
Wyatt Allenbf0502c2016-10-18 13:47:43 -070056=== Comment.soy
Martin Fick382e0a82010-07-27 17:09:33 -060057
Wyatt Allenbf0502c2016-10-18 13:47:43 -070058The `Comment.soy` template will determine the contents of the email related to
Martin Fick382e0a82010-07-27 17:09:33 -060059a user submitting comments on changes. It is a `ChangeEmail`: see
Wyatt Allenbf0502c2016-10-18 13:47:43 -070060`ChangeSubject.soy`, ChangeFooter and CommentFooter.
David Pursehouse85287c12012-09-24 20:58:21 +090061
Wyatt Allenbf0502c2016-10-18 13:47:43 -070062=== CommentFooter.soy and CommentFooterHtml.soy
David Pursehouse85287c12012-09-24 20:58:21 +090063
Wyatt Allenbf0502c2016-10-18 13:47:43 -070064The CommentFooter templates will determine the contents of the footer text that
65will be appended to emails related to a user submitting comments on changes.
66See `ChangeSubject.soy`, Comment and ChangeFooter.
Martin Fick382e0a82010-07-27 17:09:33 -060067
Wyatt Allenbf0502c2016-10-18 13:47:43 -070068=== DeleteVote.soy and DeleteVoteHtml.soy
Khai Dof6b479a2015-12-08 23:44:34 -080069
Wyatt Allenbf0502c2016-10-18 13:47:43 -070070The DeleteVote templates will determine the contents of the email related to
71removing votes on changes. It is a `ChangeEmail`: see `ChangeSubject.soy`
72and ChangeFooter.
Khai Dof6b479a2015-12-08 23:44:34 -080073
Wyatt Allenbf0502c2016-10-18 13:47:43 -070074=== DeleteReviewer.soy and DeleteReviewerHtml.soy
Khai Do2710a882015-12-10 10:42:03 -080075
Wyatt Allenbf0502c2016-10-18 13:47:43 -070076The DeleteReviewer templates will determine the contents of the email related to
77a user removing a reviewer (with a vote) from a change. It is a
78`ChangeEmail`: see `ChangeSubject.soy` and ChangeFooter.
Khai Do2710a882015-12-10 10:42:03 -080079
Wyatt Allenbf0502c2016-10-18 13:47:43 -070080=== Footer.soy and FooterHtml.soy
David Pursehouse7a1d7c02013-06-05 12:22:45 +090081
Wyatt Allenbf0502c2016-10-18 13:47:43 -070082The Footer templates will determine the contents of the footer text appended to
83the end of all outgoing emails after the ChangeFooter and CommentFooter.
David Pursehouse7a1d7c02013-06-05 12:22:45 +090084
Wyatt Allenbf0502c2016-10-18 13:47:43 -070085=== Merged.soy and MergedHtml.soy
Martin Fick7305be42010-07-23 17:31:26 -060086
Wyatt Allenbf0502c2016-10-18 13:47:43 -070087The Merged templates will determine the contents of the email related to a
88change successfully merged to the head. It is a `ChangeEmail`: see
89`ChangeSubject.soy` and ChangeFooter.
Martin Fick7305be42010-07-23 17:31:26 -060090
Wyatt Allenbf0502c2016-10-18 13:47:43 -070091=== NewChange.soy and NewChangeHtml.soy
Martin Fick679fc372010-07-21 11:46:21 -060092
Wyatt Allenbf0502c2016-10-18 13:47:43 -070093The NewChange templates will determine the contents of the email related to a
94user submitting a new change for review. This includes changes created by
95actions made by the user in the Web UI such as cherry picking a commit or
96reverting a change. It is a `ChangeEmail`: see `ChangeSubject.soy` and
97ChangeFooter.
Martin Fick679fc372010-07-21 11:46:21 -060098
Wyatt Allenbf0502c2016-10-18 13:47:43 -070099=== RegisterNewEmail.soy
Martin Fick679fc372010-07-21 11:46:21 -0600100
Wyatt Allenbf0502c2016-10-18 13:47:43 -0700101The `RegisterNewEmail.soy` template will determine the contents of the email
Martin Fick679fc372010-07-21 11:46:21 -0600102related to registering new email accounts.
103
Wyatt Allenbf0502c2016-10-18 13:47:43 -0700104=== ReplacePatchSet.soy and ReplacePatchSetHtml.soy
Martin Fick679fc372010-07-21 11:46:21 -0600105
Wyatt Allenbf0502c2016-10-18 13:47:43 -0700106The ReplacePatchSet templates will determine the contents of the email related
107to a user submitting a new patchset for a change. This includes patchsets
108created by actions made by the user in the Web UI such as editing the commit
109message, cherry picking a commit, or rebasing a change. It is a `ChangeEmail`:
110see `ChangeSubject.soy` and ChangeFooter.
Martin Fick40ed99f2010-07-21 11:46:21 -0600111
Wyatt Allenbf0502c2016-10-18 13:47:43 -0700112=== Restored.soy and RestoredHtml.soy
Martin Fick7759a6f2011-06-27 10:25:38 -0600113
Wyatt Allenbf0502c2016-10-18 13:47:43 -0700114The Restored templates will determine the contents of the email related to a
115change being restored. It is a `ChangeEmail`: see `ChangeSubject.soy` and
116ChangeFooter.
Martin Fick7759a6f2011-06-27 10:25:38 -0600117
Wyatt Allenbf0502c2016-10-18 13:47:43 -0700118=== Reverted.soy and RevertedHtml.soy
David Pursehouse8f4e01f2012-09-27 20:53:22 +0900119
Wyatt Allenbf0502c2016-10-18 13:47:43 -0700120The Reverted templates will determine the contents of the email related to a
121change being reverted. It is a `ChangeEmail`: see `ChangeSubject.soy` and
122ChangeFooter.
Martin Fick7759a6f2011-06-27 10:25:38 -0600123
Edwin Kempin49ab6f52016-12-07 10:40:32 +0100124=== SetAssignee.soy and SetAssigneeHtml.soy
125
126The SetAssignee templates will determine the contents of the email related to a
127user being assigned to a change. It is a `ChangeEmail`: see `ChangeSubject.soy`
128and ChangeFooter.
129
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600130
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800131== Mail Variables and Methods
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600132
133Mail templates can access and display objects currently made available to them
Wyatt Allenbf0502c2016-10-18 13:47:43 -0700134via the Soy context.
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600135
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800136=== Warning
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600137
David Pursehouse221d4f62012-06-08 17:38:08 +0900138Be aware that modifying templates can cause them to fail to parse and therefore
Wyatt Allenbf0502c2016-10-18 13:47:43 -0700139not send out the actual email.
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600140
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800141=== All OutgoingEmails
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600142
143All outgoing emails have the following variables available to them:
144
Wyatt Allenbf0502c2016-10-18 13:47:43 -0700145$email.settingsUrl::
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600146+
Wyatt Allenbf0502c2016-10-18 13:47:43 -0700147The URL to view the user's settings in the Gerrit web UI.
148
149$email.gerritHost::
150+
151The name of the Gerrit instance.
152
153$email.gerritUrl::
154+
155The URL to the Gerrit web UI.
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600156
157$messageClass::
158+
David Pursehouse221d4f62012-06-08 17:38:08 +0900159A String containing the messageClass.
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600160
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800161=== Change Emails
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600162
Wyatt Allenbf0502c2016-10-18 13:47:43 -0700163Change related emails have the following template data available to them, in
164addition to what's available to all outgoing emails.
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600165
166$changeId::
167+
David Pursehouse221d4f62012-06-08 17:38:08 +0900168Id of the current change (a `Change.Key`).
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600169
170$coverLetter::
171+
David Pursehouse221d4f62012-06-08 17:38:08 +0900172The text of the `ChangeMessage`.
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600173
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600174$fromName::
175+
David Pursehouse221d4f62012-06-08 17:38:08 +0900176The name of the from user.
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600177
Wyatt Allenbf0502c2016-10-18 13:47:43 -0700178$email.unifiedDiff::
179+
180The diff of the change.
181
182$email.changeDetail::
183+
184The details of the change, including the commit message.
185
186$email.changeUrl::
187+
188The URL to the change in the web UI.
189
190$email.includeDiff::
191+
192Whether the Gerrit instance is configured to include diffs in emails.
193
194$change.subject::
195+
196The subject of the current change.
197
198$change.originalSubject::
199+
200The subject corresponding to the first patch set of the current change.
201
202$change.shortSubject::
203+
204The subject limited to 63 characters, with an ellipsis if it exceeds that.
205
206$change.ownerEmail::
207+
208The email address of the owner of the change.
209
210$branch.shortName::
211+
212The name of the branch targeted by the current change.
213
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600214$projectName::
215+
David Pursehouse221d4f62012-06-08 17:38:08 +0900216The name of this change's project.
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600217
Wyatt Allenbf0502c2016-10-18 13:47:43 -0700218$shortProjectName::
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600219+
Wyatt Allenbf0502c2016-10-18 13:47:43 -0700220The project name with the path abbreviated.
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600221
Wyatt Allenbf0502c2016-10-18 13:47:43 -0700222$sshHost::
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600223+
Wyatt Allenbf0502c2016-10-18 13:47:43 -0700224SSH hostname for the Gerrit instance.
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600225
Wyatt Allenbf0502c2016-10-18 13:47:43 -0700226$patchSet.patchSetId::
227+
228The current patch set number.
229
230$patchSet.refname::
231+
232The refname of the patch set.
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600233
Martin Fickb7f3b2d2010-07-23 10:23:03 -0600234GERRIT
235------
236Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -0700237
238SEARCHBOX
239---------