From dac2de0d810087f1ec78bc190df99d41afb43787 Mon Sep 17 00:00:00 2001 From: James Moger Date: Wed, 24 Sep 2014 14:20:59 -0400 Subject: [PATCH] Support email View Ticket go-to-action --- .../java/com/gitblit/tickets/TicketNotifier.java | 9 ++++++++- src/main/java/com/gitblit/tickets/viewTicket.html | 12 ++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/gitblit/tickets/viewTicket.html diff --git a/src/main/java/com/gitblit/tickets/TicketNotifier.java b/src/main/java/com/gitblit/tickets/TicketNotifier.java index 07371b1b..5979cf26 100644 --- a/src/main/java/com/gitblit/tickets/TicketNotifier.java +++ b/src/main/java/com/gitblit/tickets/TicketNotifier.java @@ -135,6 +135,7 @@ public class TicketNotifier { StringBuilder html = new StringBuilder(); html.append(""); html.append(readStyle()); + html.append(readViewTicketAction(ticket)); html.append(""); html.append(""); html.append(MarkdownUtils.transformGFM(settings, markdown, ticket.repository)); @@ -596,7 +597,7 @@ public class TicketNotifier { // respect the author's email preference UserModel lastAuthor = userManager.getUserModel(lastChange.author); - if (!lastAuthor.getPreferences().isEmailMeOnMyTicketChanges()) { + if (lastAuthor != null && !lastAuthor.getPreferences().isEmailMeOnMyTicketChanges()) { toAddresses.remove(lastAuthor.emailAddress); ccAddresses.remove(lastAuthor.emailAddress); } @@ -613,6 +614,12 @@ public class TicketNotifier { return sb.toString(); } + protected String readViewTicketAction(TicketModel ticket) { + String action = readResource("viewTicket.html"); + action = action.replace("${url}", ticketService.getTicketUrl(ticket)); + return action; + } + protected String readResource(String resource) { StringBuilder sb = new StringBuilder(); InputStream is = null; diff --git a/src/main/java/com/gitblit/tickets/viewTicket.html b/src/main/java/com/gitblit/tickets/viewTicket.html new file mode 100644 index 00000000..54e091ca --- /dev/null +++ b/src/main/java/com/gitblit/tickets/viewTicket.html @@ -0,0 +1,12 @@ + -- 2.39.5