Merge "Add HTML template for change comment emails"
This commit is contained in:
@@ -106,7 +106,9 @@ public class SitePathInitializer {
|
||||
extractMailExample("ChangeFooterHtml.soy");
|
||||
extractMailExample("ChangeSubject.soy");
|
||||
extractMailExample("Comment.soy");
|
||||
extractMailExample("CommentHtml.soy");
|
||||
extractMailExample("CommentFooter.soy");
|
||||
extractMailExample("CommentFooterHtml.soy");
|
||||
extractMailExample("DeleteReviewer.soy");
|
||||
extractMailExample("DeleteReviewerHtml.soy");
|
||||
extractMailExample("DeleteVote.soy");
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -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",
|
||||
|
@@ -26,6 +26,11 @@
|
||||
* @param projectName
|
||||
*/
|
||||
{template .ChangeFooterHtml autoescape="strict" kind="html"}
|
||||
{let $footerStyle kind="css"}
|
||||
color: #555;
|
||||
margin: 10px 0 0 0;
|
||||
{/let}
|
||||
|
||||
{if $email.changeUrl or $email.settingsUrl}
|
||||
<p>
|
||||
{if $email.changeUrl}
|
||||
@@ -38,7 +43,7 @@
|
||||
</p>
|
||||
{/if}
|
||||
|
||||
<p style="color: #555;">
|
||||
<p style="{$footerStyle}">
|
||||
Gerrit-MessageType: {$messageClass}<br/>
|
||||
Gerrit-Change-Id: {$changeId}<br/>
|
||||
Gerrit-PatchSet: {$patchSet.patchSetId}<br/>
|
||||
|
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* Copyright (C) 2016 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.
|
||||
*/
|
||||
|
||||
{namespace com.google.gerrit.server.mail.template}
|
||||
|
||||
/**
|
||||
* @param commentFiles
|
||||
*/
|
||||
{template .CommentFooterHtml autoescape="strict" kind="html"}
|
||||
{let $footerStyle kind="css"}
|
||||
color: #555;
|
||||
margin: 0;
|
||||
{/let}
|
||||
|
||||
<p style="{$footerStyle}">
|
||||
{if length($commentFiles) > 0}
|
||||
Gerrit-HasComments: Yes
|
||||
{else}
|
||||
Gerrit-HasComments: No
|
||||
{/if}
|
||||
</p>
|
||||
{/template}
|
@@ -0,0 +1,122 @@
|
||||
/**
|
||||
* Copyright (C) 2016 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.
|
||||
*/
|
||||
|
||||
{namespace com.google.gerrit.server.mail.template}
|
||||
|
||||
/**
|
||||
* @param change
|
||||
* @param commentFiles
|
||||
* @param coverLetter
|
||||
* @param email
|
||||
* @param fromName
|
||||
*/
|
||||
{template .CommentHtml autoescape="strict" kind="html"}
|
||||
{let $commentHeaderStyle kind="css"}
|
||||
margin-bottom: 4px;
|
||||
{/let}
|
||||
|
||||
{let $blockquoteStyle kind="css"}
|
||||
border-left: 1px solid #aaa;
|
||||
margin: 10px 0;
|
||||
padding: 0 10px;
|
||||
{/let}
|
||||
|
||||
{let $messageStyle kind="css"}
|
||||
white-space: pre-wrap;
|
||||
{/let}
|
||||
|
||||
{let $ulStyle kind="css"}
|
||||
padding-left: 20px;
|
||||
{/let}
|
||||
|
||||
<p>
|
||||
{$fromName} has posted comments on this change.
|
||||
</p>
|
||||
|
||||
{if $email.changeUrl}
|
||||
<p>
|
||||
{call .ViewChangeButton data="all" /}
|
||||
</p>
|
||||
{/if}
|
||||
|
||||
<p>
|
||||
Change subject: {$change.subject}
|
||||
</p>
|
||||
<hr/>
|
||||
|
||||
{if $coverLetter}
|
||||
<pre>{$coverLetter}</pre>
|
||||
{/if}
|
||||
|
||||
<ul style="{$ulStyle}">
|
||||
{foreach $group in $commentFiles}
|
||||
<li>
|
||||
<p>
|
||||
<strong><a href="{$group.link}">{$group.title}:</a></strong>
|
||||
</p>
|
||||
|
||||
<ul style="{$ulStyle}">
|
||||
{foreach $comment in $group.comments}
|
||||
<li>
|
||||
{if $comment.isRobotComment}
|
||||
<p style="{$commentHeaderStyle}">
|
||||
Robot Comment from{sp}
|
||||
{if $comment.robotUrl}<a href="{$comment.robotUrl}">{/if}
|
||||
{$comment.robotId}
|
||||
{if $comment.robotUrl}</a>{/if}{sp}
|
||||
(run ID {$comment.robotRunId}):
|
||||
</p>
|
||||
{/if}
|
||||
|
||||
<p style="{$commentHeaderStyle}">
|
||||
{if length($comment.lines) > 0}
|
||||
Patch Set #{$group.patchSetId}, Line {$comment.startLine}:{sp}
|
||||
{/if}
|
||||
{if length($comment.lines) == 1}
|
||||
<code>{$comment.lines[0]}</code>
|
||||
{/if}
|
||||
</p>
|
||||
|
||||
{if length($comment.lines) > 1}
|
||||
<p>
|
||||
<blockquote style="{$blockquoteStyle}">
|
||||
<pre>
|
||||
{foreach $line in $comment.lines}
|
||||
{$line}{\n}
|
||||
{/foreach}
|
||||
</pre>
|
||||
</blockquote>
|
||||
</p>
|
||||
{/if}
|
||||
|
||||
{if $comment.parentMessage}
|
||||
<p>
|
||||
<blockquote style="{$blockquoteStyle}">
|
||||
{$comment.parentMessage}
|
||||
</blockquote>
|
||||
</p>
|
||||
{/if}
|
||||
|
||||
<p style="{$messageStyle}">
|
||||
{$comment.message}
|
||||
</p>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/template}
|
Reference in New Issue
Block a user