Skip to content

Commit

Permalink
#8 Fixed bug in retry link.
Browse files Browse the repository at this point in the history
  • Loading branch information
nickgrealy committed Mar 13, 2016
1 parent 44d2c98 commit 94f36b2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ public static FormValidation checkForEmails(CustomProperties properties, XTrigge
properties.remove(Properties.password);
buildParams.putAll(properties, prefix);
// build a "retry" link...
buildParams.put("pmt_retryEmailLink", buildEmailRetryLink(properties));
buildParams.put("pmt_retryEmailLink", buildEmailRetryLink(buildParams));

String jobCause = "Job was triggered by email sent from " + stringify(message.getFrom());
// start a jenkins job...
Expand Down Expand Up @@ -260,10 +260,17 @@ public static FormValidation checkForEmails(CustomProperties properties, XTrigge
}

public static String buildEmailRetryLink(CustomProperties properties){
String recipients = properties.get("pmt_recipients");
String subject = properties.get("pmt_subject");
String body = properties.get("pmt_content");
String htmlNewline = "%0D%0A";
if (nonNull(body)){
body = body.replaceAll("\r\n", htmlNewline).replaceAll("\n", htmlNewline);
}
return String.format("<a href=\"mailto:%s?subject=%s&body=%s\">Click to Retry Job</a>",
properties.get("pmt_recipients"),
properties.get("pmt_subject"),
properties.get("pmt_body")
recipients,
subject,
body
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Feature: Runtime - Start Job
| pmt_receivedXMinutesAgo | 1440 |
| pmt_recipients | foo3@bar.com,foo4@bar.com |
| pmt_replyTo | nick@email.com |
| pmt_retryEmailLink | <a href="mailto:null?subject=null&body=null">Click to Retry Job</a> |
| pmt_retryEmailLink | <a href="mailto:foo3@bar.com,foo4@bar.com?subject=Jenkins > Build Plugin #4&body=%0D%0Aaaa=bbb%0D%0Afoo=<b>bar</b>">Click to Retry Job</a> |
| pmt_storeName | imap |
| pmt_subject | Jenkins > Build Plugin #4 |
| pmt_subjectContains | jenkins > |
Expand Down

0 comments on commit 94f36b2

Please sign in to comment.