Add shortOriginalSubject to change email template params
Change email templates could make use of the change's current subject, the change's original subject or the change's shortened current subject. But they could not use the change's shortened original subject. With this change that parameter is provided to change email templates. Change-Id: I6fc393bb9bca9aa0365ebfc47ac34fc326ba5277
This commit is contained in:
@@ -204,6 +204,11 @@ $change.shortSubject::
|
||||
+
|
||||
The subject limited to 72 characters, with an ellipsis if it exceeds that.
|
||||
|
||||
$change.shortOriginalSubject::
|
||||
+
|
||||
The original subject limited to 72 characters, with an ellipsis if it exceeds
|
||||
that.
|
||||
|
||||
$change.ownerEmail::
|
||||
+
|
||||
The email address of the owner of the change.
|
||||
|
@@ -461,23 +461,19 @@ public abstract class ChangeEmail extends NotificationEmail {
|
||||
soyContextEmailData.put("includeDiff", getIncludeDiff());
|
||||
|
||||
Map<String, String> changeData = new HashMap<>();
|
||||
changeData.put("subject", change.getSubject());
|
||||
changeData.put("originalSubject", change.getOriginalSubject());
|
||||
|
||||
String subject = change.getSubject();
|
||||
String originalSubject = change.getOriginalSubject();
|
||||
changeData.put("subject", subject);
|
||||
changeData.put("originalSubject", originalSubject);
|
||||
changeData.put("shortSubject", shortenSubject(subject));
|
||||
changeData.put("shortOriginalSubject", shortenSubject(originalSubject));
|
||||
|
||||
changeData.put("ownerName", getNameFor(change.getOwner()));
|
||||
changeData.put("ownerEmail", getNameEmailFor(change.getOwner()));
|
||||
changeData.put("changeNumber", Integer.toString(change.getChangeId()));
|
||||
soyContext.put("change", changeData);
|
||||
|
||||
String subject = change.getSubject();
|
||||
changeData.put("subject", subject);
|
||||
// shortSubject is the subject limited to 63 characters, with an ellipsis if
|
||||
// it exceeds that.
|
||||
if (subject.length() < 73) {
|
||||
changeData.put("shortSubject", subject);
|
||||
} else {
|
||||
changeData.put("shortSubject", subject.substring(0, 69) + "...");
|
||||
}
|
||||
|
||||
Map<String, Object> patchSetData = new HashMap<>();
|
||||
patchSetData.put("patchSetId", patchSet.getPatchSetId());
|
||||
patchSetData.put("refName", patchSet.getRefName());
|
||||
@@ -504,6 +500,18 @@ public abstract class ChangeEmail extends NotificationEmail {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A shortened subject is the subject limited to 72 characters, with an ellipsis if it exceeds
|
||||
* that limit.
|
||||
*/
|
||||
private static String shortenSubject(String subject) {
|
||||
if (subject.length() < 73) {
|
||||
return subject;
|
||||
} else {
|
||||
return subject.substring(0, 69) + "...";
|
||||
}
|
||||
}
|
||||
|
||||
private Set<String> getEmailsByState(ReviewerStateInternal state) {
|
||||
Set<String> reviewers = new TreeSet<>();
|
||||
try {
|
||||
|
Reference in New Issue
Block a user