Convert the Abandoned and MergeFail email classes to templates
Convert the AbandonedSender and MergeFailSender classes to use file based velocity templates which an admin may edit. Change-Id: I5eae65a46aea074ef25bfc259c013f9be91fdc2f
This commit is contained in:
@@ -25,6 +25,13 @@ are listed below. Change emails are influenced by two additional templates,
|
|||||||
one to set the subject line, and one to set the footer which gets appended to
|
one to set the subject line, and one to set the footer which gets appended to
|
||||||
all the change emails (see `ChangeSubject.vm` and `ChangeFooter.vm` below.)
|
all the change emails (see `ChangeSubject.vm` and `ChangeFooter.vm` below.)
|
||||||
|
|
||||||
|
Abandoned.vm
|
||||||
|
~~~~~~~~~~~~
|
||||||
|
|
||||||
|
The `Abandoned.vm` template will determine the contents of the email related
|
||||||
|
to a change being abandoned. It is a `ChangeEmail`: see `ChangeSubject.vm` and
|
||||||
|
`ChangeFooter.vm`.
|
||||||
|
|
||||||
ChangeFooter.vm
|
ChangeFooter.vm
|
||||||
~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
@@ -50,6 +57,13 @@ The `Merged.vm` template will determine the contents of the email related to
|
|||||||
a change successfully merged to the head. It is a `ChangeEmail`: see
|
a change successfully merged to the head. It is a `ChangeEmail`: see
|
||||||
`ChangeSubject.vm` and `ChangeFooter.vm`.
|
`ChangeSubject.vm` and `ChangeFooter.vm`.
|
||||||
|
|
||||||
|
MergeFail.vm
|
||||||
|
~~~~~~~~~~~~
|
||||||
|
|
||||||
|
The `MergeFail.vm` template will determine the contents of the email related
|
||||||
|
to a failure upon attempting to merge a change to the head. It is a
|
||||||
|
`ChangeEmail`: see `ChangeSubject.vm` and `ChangeFooter.vm`.
|
||||||
|
|
||||||
|
|
||||||
Mail Variables and Methods
|
Mail Variables and Methods
|
||||||
--------------------------
|
--------------------------
|
||||||
|
@@ -85,10 +85,12 @@ public class SitePathInitializer {
|
|||||||
extract(site.gerrit_sh, Init.class, "gerrit.sh");
|
extract(site.gerrit_sh, Init.class, "gerrit.sh");
|
||||||
chmod(0755, site.gerrit_sh);
|
chmod(0755, site.gerrit_sh);
|
||||||
|
|
||||||
|
extractMailExample("Abandoned.vm");
|
||||||
extractMailExample("ChangeFooter.vm");
|
extractMailExample("ChangeFooter.vm");
|
||||||
extractMailExample("ChangeSubject.vm");
|
extractMailExample("ChangeSubject.vm");
|
||||||
extractMailExample("Comment.vm");
|
extractMailExample("Comment.vm");
|
||||||
extractMailExample("Merged.vm");
|
extractMailExample("Merged.vm");
|
||||||
|
extractMailExample("MergeFail.vm");
|
||||||
|
|
||||||
if (!ui.isBatch()) {
|
if (!ui.isBatch()) {
|
||||||
System.err.println();
|
System.err.println();
|
||||||
|
@@ -40,9 +40,6 @@ public class AbandonedSender extends ReplyToChangeSender {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void formatChange() throws EmailException {
|
protected void formatChange() throws EmailException {
|
||||||
appendText(getNameFor(fromId));
|
appendText(velocifyFile("Abandoned.vm"));
|
||||||
appendText(" has abandoned change " + change.getKey().abbreviate() + ":\n");
|
|
||||||
appendText("\n");
|
|
||||||
formatCoverLetter();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -38,15 +38,6 @@ public class MergeFailSender extends ReplyToChangeSender {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void formatChange() throws EmailException {
|
protected void formatChange() throws EmailException {
|
||||||
appendText("Change " + change.getKey().abbreviate());
|
appendText(velocifyFile("MergeFail.vm"));
|
||||||
if (patchSetInfo != null && patchSetInfo.getAuthor() != null
|
|
||||||
&& patchSetInfo.getAuthor().getName() != null) {
|
|
||||||
appendText(" by ");
|
|
||||||
appendText(patchSetInfo.getAuthor().getName());
|
|
||||||
}
|
|
||||||
appendText(" FAILED to submit to ");
|
|
||||||
appendText(change.getDest().getShortName());
|
|
||||||
appendText(".\n\n");
|
|
||||||
formatCoverLetter();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,40 @@
|
|||||||
|
## Copyright (C) 2010 The Android Open Source Project
|
||||||
|
##
|
||||||
|
## Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
## you may not use this file except in compliance with the License.
|
||||||
|
## You may obtain a copy of the License at
|
||||||
|
##
|
||||||
|
## http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
##
|
||||||
|
## Unless required by applicable law or agreed to in writing, software
|
||||||
|
## distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
## See the License for the specific language governing permissions and
|
||||||
|
## limitations under the License.
|
||||||
|
##
|
||||||
|
##
|
||||||
|
## Template Type:
|
||||||
|
## -------------
|
||||||
|
## This is a velocity mail template, see: http://velocity.apache.org and the
|
||||||
|
## gerrit-docs:config-mail.txt for more info on modifying gerrit mail templates.
|
||||||
|
##
|
||||||
|
## Template File Names and extensions:
|
||||||
|
## ----------------------------------
|
||||||
|
## Gerrit will use templates ending in ".vm" but will ignore templates ending
|
||||||
|
## in ".vm.example". If a .vm template does not exist, the default internal
|
||||||
|
## gerrit template which is the same as the .vm.example will be used. If you
|
||||||
|
## want to override the default template, copy the .vm.exmaple file to a .vm
|
||||||
|
## file and edit it appropriately.
|
||||||
|
##
|
||||||
|
## This Template:
|
||||||
|
## --------------
|
||||||
|
## The Abandoned.vm template will determine the contents of the email related
|
||||||
|
## to a change being abandoned. It is a ChangeEmail: see ChangeSubject.vm and
|
||||||
|
## ChangeFooter.vm.
|
||||||
|
##
|
||||||
|
$fromName has abandoned change $changeId.abbreviate():
|
||||||
|
|
||||||
|
#if ($coverLetter)
|
||||||
|
$coverLetter
|
||||||
|
|
||||||
|
#end
|
@@ -0,0 +1,41 @@
|
|||||||
|
## Copyright (C) 2010 The Android Open Source Project
|
||||||
|
##
|
||||||
|
## Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
## you may not use this file except in compliance with the License.
|
||||||
|
## You may obtain a copy of the License at
|
||||||
|
##
|
||||||
|
## http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
##
|
||||||
|
## Unless required by applicable law or agreed to in writing, software
|
||||||
|
## distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
## See the License for the specific language governing permissions and
|
||||||
|
## limitations under the License.
|
||||||
|
##
|
||||||
|
##
|
||||||
|
## Template Type:
|
||||||
|
## -------------
|
||||||
|
## This is a velocity mail template, see: http://velocity.apache.org and the
|
||||||
|
## gerrit-docs:config-mail.txt for more info on modifying gerrit mail templates.
|
||||||
|
##
|
||||||
|
## Template File Names and extensions:
|
||||||
|
## ----------------------------------
|
||||||
|
## Gerrit will use templates ending in ".vm" but will ignore templates ending
|
||||||
|
## in ".vm.example". If a .vm template does not exist, the default internal
|
||||||
|
## gerrit template which is the same as the .vm.example will be used. If you
|
||||||
|
## want to override the default template, copy the .vm.exmaple file to a .vm
|
||||||
|
## file and edit it appropriately.
|
||||||
|
##
|
||||||
|
## This Template:
|
||||||
|
## --------------
|
||||||
|
## The MergeFail.vm template will determine the contents of the email related
|
||||||
|
## to a failure upon attempting to merge a change to the head. It is a
|
||||||
|
## ChangeEmail: see ChangeSubject.vm and ChangeFooter.vm.
|
||||||
|
##
|
||||||
|
Change $change.key.abbreviate()#if ($patchSetInfo.author.name)
|
||||||
|
by $patchSetInfo.author.name#end FAILED to submit to ${change.dest.shortName}.
|
||||||
|
|
||||||
|
#if ($email.coverLetter)
|
||||||
|
$email.coverLetter
|
||||||
|
|
||||||
|
#end
|
Reference in New Issue
Block a user