Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 1 | = Gerrit Code Review - Mail Templates |
Martin Fick | b7f3b2d | 2010-07-23 10:23:03 -0600 | [diff] [blame] | 2 | |
David Pursehouse | 98b6003 | 2017-04-04 15:19:59 +0900 | [diff] [blame] | 3 | Gerrit uses link:https://developers.google.com/closure/templates/[Closure Templates] |
| 4 | (Soy) for the bulk of the standard mails it sends out. |
Martin Fick | b7f3b2d | 2010-07-23 10:23:03 -0600 | [diff] [blame] | 5 | There are builtin default templates which are used if they are not overridden. |
| 6 | These defaults are also provided as examples so that administrators may copy |
| 7 | them and easily modify them to tweak their contents. |
| 8 | |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 9 | *Compatibility Note:* previously, Velocity Template Language (VTL) was used as |
| 10 | the template language for Gerrit emails. VTL has now been deprecated in favor of |
| 11 | Soy, but Velocity templates that modify text emails remain supported for now. |
Martin Fick | b7f3b2d | 2010-07-23 10:23:03 -0600 | [diff] [blame] | 12 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 13 | == Template Locations and Extensions: |
Martin Fick | b7f3b2d | 2010-07-23 10:23:03 -0600 | [diff] [blame] | 14 | |
| 15 | The default example templates reside under: `'$site_path'/etc/mail` and are |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 16 | terminated with the double extension `.soy.example`. Modifying these example |
Martin Fick | b7f3b2d | 2010-07-23 10:23:03 -0600 | [diff] [blame] | 17 | files will have no effect on the behavior of Gerrit. However, copying an |
| 18 | example template to an equivalently named file without the `.example` extension |
| 19 | and modifying it will allow an administrator to customize the template. |
| 20 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 21 | == Supported Mail Templates: |
Martin Fick | b7f3b2d | 2010-07-23 10:23:03 -0600 | [diff] [blame] | 22 | |
David Pursehouse | 221d4f6 | 2012-06-08 17:38:08 +0900 | [diff] [blame] | 23 | Each mail that Gerrit sends out is controlled by at least one template. These |
Martin Fick | b7f3b2d | 2010-07-23 10:23:03 -0600 | [diff] [blame] | 24 | are listed below. Change emails are influenced by two additional templates, |
| 25 | one to set the subject line, and one to set the footer which gets appended to |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 26 | all the change emails (see `ChangeSubject.soy` and `ChangeFooter.soy` below.) |
Martin Fick | b7f3b2d | 2010-07-23 10:23:03 -0600 | [diff] [blame] | 27 | |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 28 | Many types of Gerrit email message support HTML in addition to plain-text. Where |
| 29 | both are supported, templates to control the HTML part have `...Html` appended |
| 30 | in their file names. For example, for "Abandoned" emails, the `Abandoned.soy` |
| 31 | template determines the text part of the message, whereas `AbandonedHtml.soy` |
| 32 | determines the HTML part. |
Martin Fick | 40ed99f | 2010-07-21 11:46:21 -0600 | [diff] [blame] | 33 | |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 34 | === Abandoned.soy and AbandonedHtml.soy |
Martin Fick | 40ed99f | 2010-07-21 11:46:21 -0600 | [diff] [blame] | 35 | |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 36 | The "Abandoned" templates will determine the contents of the email related to a |
| 37 | change being abandoned. It is a `ChangeEmail`: see `ChangeSubject.soy` and |
| 38 | ChangeFooter. |
Doug Kelly | 251b157 | 2015-08-25 11:02:04 -0500 | [diff] [blame] | 39 | |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 40 | === AddKey.soy and AddKeyHtml.soy |
Doug Kelly | 251b157 | 2015-08-25 11:02:04 -0500 | [diff] [blame] | 41 | |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 42 | AddKey templates will determine the contents of the email related to SSH and GPG |
| 43 | keys being added to a user account. This notification is not sent when the key |
| 44 | is administratively added to another user account. |
Martin Fick | 82bd12c | 2010-07-21 11:46:21 -0600 | [diff] [blame] | 45 | |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 46 | === ChangeFooter.soy and ChangeFooterHtml.soy |
Martin Fick | 82bd12c | 2010-07-21 11:46:21 -0600 | [diff] [blame] | 47 | |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 48 | The ChangeFooter templates will determine the contents of the footer that will |
| 49 | be appended to emails related to changes (all `ChangeEmail`s). |
Martin Fick | b7f3b2d | 2010-07-23 10:23:03 -0600 | [diff] [blame] | 50 | |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 51 | === ChangeSubject.soy |
| 52 | |
| 53 | The `ChangeSubject.soy` template will determine the contents of the email |
Martin Fick | b7f3b2d | 2010-07-23 10:23:03 -0600 | [diff] [blame] | 54 | subject line for ALL emails related to changes. |
| 55 | |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 56 | === Comment.soy |
Martin Fick | 382e0a8 | 2010-07-27 17:09:33 -0600 | [diff] [blame] | 57 | |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 58 | The `Comment.soy` template will determine the contents of the email related to |
Martin Fick | 382e0a8 | 2010-07-27 17:09:33 -0600 | [diff] [blame] | 59 | a user submitting comments on changes. It is a `ChangeEmail`: see |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 60 | `ChangeSubject.soy`, ChangeFooter and CommentFooter. |
David Pursehouse | 85287c1 | 2012-09-24 20:58:21 +0900 | [diff] [blame] | 61 | |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 62 | === CommentFooter.soy and CommentFooterHtml.soy |
David Pursehouse | 85287c1 | 2012-09-24 20:58:21 +0900 | [diff] [blame] | 63 | |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 64 | The CommentFooter templates will determine the contents of the footer text that |
| 65 | will be appended to emails related to a user submitting comments on changes. |
| 66 | See `ChangeSubject.soy`, Comment and ChangeFooter. |
Martin Fick | 382e0a8 | 2010-07-27 17:09:33 -0600 | [diff] [blame] | 67 | |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 68 | === DeleteVote.soy and DeleteVoteHtml.soy |
Khai Do | f6b479a | 2015-12-08 23:44:34 -0800 | [diff] [blame] | 69 | |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 70 | The DeleteVote templates will determine the contents of the email related to |
| 71 | removing votes on changes. It is a `ChangeEmail`: see `ChangeSubject.soy` |
| 72 | and ChangeFooter. |
Khai Do | f6b479a | 2015-12-08 23:44:34 -0800 | [diff] [blame] | 73 | |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 74 | === DeleteReviewer.soy and DeleteReviewerHtml.soy |
Khai Do | 2710a88 | 2015-12-10 10:42:03 -0800 | [diff] [blame] | 75 | |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 76 | The DeleteReviewer templates will determine the contents of the email related to |
| 77 | a user removing a reviewer (with a vote) from a change. It is a |
| 78 | `ChangeEmail`: see `ChangeSubject.soy` and ChangeFooter. |
Khai Do | 2710a88 | 2015-12-10 10:42:03 -0800 | [diff] [blame] | 79 | |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 80 | === Footer.soy and FooterHtml.soy |
David Pursehouse | 7a1d7c0 | 2013-06-05 12:22:45 +0900 | [diff] [blame] | 81 | |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 82 | The Footer templates will determine the contents of the footer text appended to |
| 83 | the end of all outgoing emails after the ChangeFooter and CommentFooter. |
David Pursehouse | 7a1d7c0 | 2013-06-05 12:22:45 +0900 | [diff] [blame] | 84 | |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 85 | === Merged.soy and MergedHtml.soy |
Martin Fick | 7305be4 | 2010-07-23 17:31:26 -0600 | [diff] [blame] | 86 | |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 87 | The Merged templates will determine the contents of the email related to a |
| 88 | change successfully merged to the head. It is a `ChangeEmail`: see |
| 89 | `ChangeSubject.soy` and ChangeFooter. |
Martin Fick | 7305be4 | 2010-07-23 17:31:26 -0600 | [diff] [blame] | 90 | |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 91 | === NewChange.soy and NewChangeHtml.soy |
Martin Fick | 679fc37 | 2010-07-21 11:46:21 -0600 | [diff] [blame] | 92 | |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 93 | The NewChange templates will determine the contents of the email related to a |
| 94 | user submitting a new change for review. This includes changes created by |
| 95 | actions made by the user in the Web UI such as cherry picking a commit or |
| 96 | reverting a change. It is a `ChangeEmail`: see `ChangeSubject.soy` and |
| 97 | ChangeFooter. |
Martin Fick | 679fc37 | 2010-07-21 11:46:21 -0600 | [diff] [blame] | 98 | |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 99 | === RegisterNewEmail.soy |
Martin Fick | 679fc37 | 2010-07-21 11:46:21 -0600 | [diff] [blame] | 100 | |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 101 | The `RegisterNewEmail.soy` template will determine the contents of the email |
Martin Fick | 679fc37 | 2010-07-21 11:46:21 -0600 | [diff] [blame] | 102 | related to registering new email accounts. |
| 103 | |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 104 | === ReplacePatchSet.soy and ReplacePatchSetHtml.soy |
Martin Fick | 679fc37 | 2010-07-21 11:46:21 -0600 | [diff] [blame] | 105 | |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 106 | The ReplacePatchSet templates will determine the contents of the email related |
| 107 | to a user submitting a new patchset for a change. This includes patchsets |
| 108 | created by actions made by the user in the Web UI such as editing the commit |
| 109 | message, cherry picking a commit, or rebasing a change. It is a `ChangeEmail`: |
| 110 | see `ChangeSubject.soy` and ChangeFooter. |
Martin Fick | 40ed99f | 2010-07-21 11:46:21 -0600 | [diff] [blame] | 111 | |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 112 | === Restored.soy and RestoredHtml.soy |
Martin Fick | 7759a6f | 2011-06-27 10:25:38 -0600 | [diff] [blame] | 113 | |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 114 | The Restored templates will determine the contents of the email related to a |
| 115 | change being restored. It is a `ChangeEmail`: see `ChangeSubject.soy` and |
| 116 | ChangeFooter. |
Martin Fick | 7759a6f | 2011-06-27 10:25:38 -0600 | [diff] [blame] | 117 | |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 118 | === Reverted.soy and RevertedHtml.soy |
David Pursehouse | 8f4e01f | 2012-09-27 20:53:22 +0900 | [diff] [blame] | 119 | |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 120 | The Reverted templates will determine the contents of the email related to a |
| 121 | change being reverted. It is a `ChangeEmail`: see `ChangeSubject.soy` and |
| 122 | ChangeFooter. |
Martin Fick | 7759a6f | 2011-06-27 10:25:38 -0600 | [diff] [blame] | 123 | |
Edwin Kempin | 49ab6f5 | 2016-12-07 10:40:32 +0100 | [diff] [blame] | 124 | === SetAssignee.soy and SetAssigneeHtml.soy |
| 125 | |
| 126 | The SetAssignee templates will determine the contents of the email related to a |
| 127 | user being assigned to a change. It is a `ChangeEmail`: see `ChangeSubject.soy` |
| 128 | and ChangeFooter. |
| 129 | |
Martin Fick | b7f3b2d | 2010-07-23 10:23:03 -0600 | [diff] [blame] | 130 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 131 | == Mail Variables and Methods |
Martin Fick | b7f3b2d | 2010-07-23 10:23:03 -0600 | [diff] [blame] | 132 | |
| 133 | Mail templates can access and display objects currently made available to them |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 134 | via the Soy context. |
Martin Fick | b7f3b2d | 2010-07-23 10:23:03 -0600 | [diff] [blame] | 135 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 136 | === Warning |
Martin Fick | b7f3b2d | 2010-07-23 10:23:03 -0600 | [diff] [blame] | 137 | |
David Pursehouse | 221d4f6 | 2012-06-08 17:38:08 +0900 | [diff] [blame] | 138 | Be aware that modifying templates can cause them to fail to parse and therefore |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 139 | not send out the actual email. |
Martin Fick | b7f3b2d | 2010-07-23 10:23:03 -0600 | [diff] [blame] | 140 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 141 | === All OutgoingEmails |
Martin Fick | b7f3b2d | 2010-07-23 10:23:03 -0600 | [diff] [blame] | 142 | |
| 143 | All outgoing emails have the following variables available to them: |
| 144 | |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 145 | $email.settingsUrl:: |
Martin Fick | b7f3b2d | 2010-07-23 10:23:03 -0600 | [diff] [blame] | 146 | + |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 147 | The URL to view the user's settings in the Gerrit web UI. |
| 148 | |
| 149 | $email.gerritHost:: |
| 150 | + |
| 151 | The name of the Gerrit instance. |
| 152 | |
| 153 | $email.gerritUrl:: |
| 154 | + |
| 155 | The URL to the Gerrit web UI. |
Martin Fick | b7f3b2d | 2010-07-23 10:23:03 -0600 | [diff] [blame] | 156 | |
| 157 | $messageClass:: |
| 158 | + |
David Pursehouse | 221d4f6 | 2012-06-08 17:38:08 +0900 | [diff] [blame] | 159 | A String containing the messageClass. |
Martin Fick | b7f3b2d | 2010-07-23 10:23:03 -0600 | [diff] [blame] | 160 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 161 | === Change Emails |
Martin Fick | b7f3b2d | 2010-07-23 10:23:03 -0600 | [diff] [blame] | 162 | |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 163 | Change related emails have the following template data available to them, in |
| 164 | addition to what's available to all outgoing emails. |
Martin Fick | b7f3b2d | 2010-07-23 10:23:03 -0600 | [diff] [blame] | 165 | |
| 166 | $changeId:: |
| 167 | + |
David Pursehouse | 221d4f6 | 2012-06-08 17:38:08 +0900 | [diff] [blame] | 168 | Id of the current change (a `Change.Key`). |
Martin Fick | b7f3b2d | 2010-07-23 10:23:03 -0600 | [diff] [blame] | 169 | |
| 170 | $coverLetter:: |
| 171 | + |
David Pursehouse | 221d4f6 | 2012-06-08 17:38:08 +0900 | [diff] [blame] | 172 | The text of the `ChangeMessage`. |
Martin Fick | b7f3b2d | 2010-07-23 10:23:03 -0600 | [diff] [blame] | 173 | |
Martin Fick | b7f3b2d | 2010-07-23 10:23:03 -0600 | [diff] [blame] | 174 | $fromName:: |
| 175 | + |
David Pursehouse | 221d4f6 | 2012-06-08 17:38:08 +0900 | [diff] [blame] | 176 | The name of the from user. |
Martin Fick | b7f3b2d | 2010-07-23 10:23:03 -0600 | [diff] [blame] | 177 | |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 178 | $email.unifiedDiff:: |
| 179 | + |
| 180 | The diff of the change. |
| 181 | |
| 182 | $email.changeDetail:: |
| 183 | + |
| 184 | The details of the change, including the commit message. |
| 185 | |
| 186 | $email.changeUrl:: |
| 187 | + |
| 188 | The URL to the change in the web UI. |
| 189 | |
| 190 | $email.includeDiff:: |
| 191 | + |
| 192 | Whether the Gerrit instance is configured to include diffs in emails. |
| 193 | |
| 194 | $change.subject:: |
| 195 | + |
| 196 | The subject of the current change. |
| 197 | |
| 198 | $change.originalSubject:: |
| 199 | + |
| 200 | The subject corresponding to the first patch set of the current change. |
| 201 | |
| 202 | $change.shortSubject:: |
| 203 | + |
| 204 | The subject limited to 63 characters, with an ellipsis if it exceeds that. |
| 205 | |
| 206 | $change.ownerEmail:: |
| 207 | + |
| 208 | The email address of the owner of the change. |
| 209 | |
| 210 | $branch.shortName:: |
| 211 | + |
| 212 | The name of the branch targeted by the current change. |
| 213 | |
Martin Fick | b7f3b2d | 2010-07-23 10:23:03 -0600 | [diff] [blame] | 214 | $projectName:: |
| 215 | + |
David Pursehouse | 221d4f6 | 2012-06-08 17:38:08 +0900 | [diff] [blame] | 216 | The name of this change's project. |
Martin Fick | b7f3b2d | 2010-07-23 10:23:03 -0600 | [diff] [blame] | 217 | |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 218 | $shortProjectName:: |
Martin Fick | b7f3b2d | 2010-07-23 10:23:03 -0600 | [diff] [blame] | 219 | + |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 220 | The project name with the path abbreviated. |
Martin Fick | b7f3b2d | 2010-07-23 10:23:03 -0600 | [diff] [blame] | 221 | |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 222 | $sshHost:: |
Martin Fick | b7f3b2d | 2010-07-23 10:23:03 -0600 | [diff] [blame] | 223 | + |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 224 | SSH hostname for the Gerrit instance. |
Martin Fick | b7f3b2d | 2010-07-23 10:23:03 -0600 | [diff] [blame] | 225 | |
Wyatt Allen | bf0502c | 2016-10-18 13:47:43 -0700 | [diff] [blame] | 226 | $patchSet.patchSetId:: |
| 227 | + |
| 228 | The current patch set number. |
| 229 | |
| 230 | $patchSet.refname:: |
| 231 | + |
| 232 | The refname of the patch set. |
Martin Fick | b7f3b2d | 2010-07-23 10:23:03 -0600 | [diff] [blame] | 233 | |
Martin Fick | b7f3b2d | 2010-07-23 10:23:03 -0600 | [diff] [blame] | 234 | GERRIT |
| 235 | ------ |
| 236 | Part of link:index.html[Gerrit Code Review] |
Yuxuan 'fishy' Wang | 99cb68d | 2013-10-31 17:26:00 -0700 | [diff] [blame] | 237 | |
| 238 | SEARCHBOX |
| 239 | --------- |