Add HTML template for change comment emails

Upgrade comment emails to emit HTML bodies in addition to the existing
plain-text message bodies. The format of the HTML body is remains
similar to the plain-text format, with the following small changes:

* File links are anchor tags rather than plain URLs.
* Parent comment quotations are set in BLOCKQUOTE tags rather than
  prefixed by the > character.
* Code quotations are monospaced rather than set in a
  proportionate-width font.
* Mult-line code quotations are set in BLOCKQUOTE tags rather than
  being prefixed by spaces followed by a colon.
* File groupings are set in nested UL & and LI tags rather than
  separating groups with an extra line feed.

Change-Id: I2ac21961b6d48e3fb3455ca6a3e30d86e50b567c
This commit is contained in:
Wyatt Allen
2016-09-28 12:51:32 -07:00
parent 11bff0a6c6
commit 2223cb7c52
6 changed files with 179 additions and 1 deletions

View File

@@ -136,11 +136,17 @@ public class CommentSender extends ReplyToChangeSender {
@Override
public void formatChange() throws EmailException {
appendText(textTemplate("Comment"));
if (useHtml()) {
appendHtml(soyHtmlTemplate("CommentHtml"));
}
}
@Override
public void formatFooter() throws EmailException {
appendText(textTemplate("CommentFooter"));
if (useHtml()) {
appendHtml(soyHtmlTemplate("CommentFooterHtml"));
}
}
/**
@@ -469,6 +475,7 @@ public class CommentSender extends ReplyToChangeSender {
commentData.put("isRobotComment", true);
commentData.put("robotId", robotComment.robotId);
commentData.put("robotRunId", robotComment.robotRunId);
commentData.put("robotUrl", robotComment.url);
} else {
commentData.put("isRobotComment", false);
}
@@ -521,4 +528,9 @@ public class CommentSender extends ReplyToChangeSender {
return "";
}
}
@Override
protected boolean supportsHtml() {
return true;
}
}

View File

@@ -44,7 +44,9 @@ public class MailSoyTofuProvider implements Provider<SoyTofu> {
"ChangeFooterHtml.soy",
"ChangeSubject.soy",
"Comment.soy",
"CommentHtml.soy",
"CommentFooter.soy",
"CommentFooterHtml.soy",
"DeleteReviewer.soy",
"DeleteReviewerHtml.soy",
"DeleteVote.soy",