Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-15207

Add TemplateIssue objects to the VelocityContext of text subscription e-mails

    XMLWordPrintable

Details

    • We collect Jira feedback from various sources, and we evaluate what we've collected when planning our product roadmap. To understand how this piece of feedback will be reviewed, see our Implementation of New Features Policy.

    Description

      NOTE: This suggestion is for JIRA Server. Using JIRA Cloud? See the corresponding suggestion.

      The HTML issue summary template uses a cheat to display custom fields and extra issue fields the TEXT template does not have access to. The template type does not provide a list of com.atlassian.jira.mail.TemplateIssue objects resulting in severe limitations on available data. This makes it extremely challenging to support the hundreds of Blackberry users we have a Electronic Arts.

      The issue with Blackberry support is the email client converts HTML messages to TEXT leaving an unreadable message if it contains tables or URL's. Table structures are removed and replaced with space delimited fields and URL's are presented in place in full, no matter how long and unreadable they are on the tiny screen. None of the HTML templates are readable on a blackberry device, and the TEXT templates only tell you the absolute bare minimum about each issue.

      The documentation at http://confluence.atlassian.com/display/JIRA/JIRA+3.6+-+Velocity+Context+for+Email+Templates does not mention the collection variable $issues, and the items it contains do not appear to be the com.atlassian.jira.mail.TemplateIssue data type.

      Take a look at the following template.

      \atlassian-jira\WEB-INF\classes\templates\email\text\includes\issuesummary.vm


      It contains statements such as

      $issue.getNiceTimeEstimate($i18n)


      The $issue variable is part of the velocity context in a similar way the collection $issues is part of the context in the following template.

      \atlassian-jira\WEB-INF\classes\templates\email\text\filtersubscription.vm


      It seems logical the following code should work in the filtersubscription.vm template right?

      #foreach ($issue in $issues)
      [$issue.getKey()] Time Estimate: $issue.getNiceTimeEstimate($i18n)
      #end


      All you get is

      [SM-7] Time Estimate: $issue.getNiceTimeEstimate($i18n) 
      [SM-6] Time Estimate: $issue.getNiceTimeEstimate($i18n) 
      [SM-5] Time Estimate: $issue.getNiceTimeEstimate($i18n) 
      [SM-4] Time Estimate: $issue.getNiceTimeEstimate($i18n) 
      [SM-3] Time Estimate: $issue.getNiceTimeEstimate($i18n) 
      [SM-2] Time Estimate: $issue.getNiceTimeEstimate($i18n) 
      [SM-1] Time Estimate: $issue.getNiceTimeEstimate($i18n)
      


      It would seem the logic is not the same between the two template types, and the source code proves that in \jira\src\java\com\atlassian\jira\mail\SubscriptionMailQueueItem.java line 303.

      . . .
      SearchResults results = searcher.search(sr, u, PagerFilter.getUnlimitedFilter());
      List issues = results.getIssues();
      . . . 
      ActionContext.setContext(oldCtx);
      contextParams.put("baseHREF", getBaseURLWithoutContext(baseURL));
      contextParams.put("issueTableHtml", issueTableHtml);
      contextParams.put("issues", issues);   
      contextParams.put("constantsManager", ManagerFactory.getConstantsManager());
      contextParams.put("userManager", UserManager.getInstance());
      contextParams.put("user", u);
      


      The $issues collection is a collection of com.atlassian.jira.issue.Issue rather than com.atlassian.jira.mail.TemplateIssue which has the handy formating the documentation alludes too.


      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              68a51bbf36a3 Darren Martz
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: