You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Problem: Your Raley notification is sending all of the comments related to an issue, but comments are sorted in ascending order, i.e. from oldest to newest. How to reverse the order so, that the newest comments come first and the oldest would be in the end of the list?


Solution: Reversing of the order is done by applying some Velocity tricks. If you're not willing to dive into details, then take this as a working example and feel free to use in your notification.

Listing of comments in reverse order
<b>Comment History:</b><br>

<table border="0" cellspacing="10">
#set($max = $issue.fields.comment.comments.size() - 1)

#foreach($i in [ $max ..  0 ])
   #set ($comment = $issue.fields.comment.comments.get($i) )   
   <tr>
       <td valign="top"><b>$comment.author.displayName</b></td>
       <td valign="top" nowrap>$jirassimo.formatDate($comment.created, "yyyy-MM-dd HH:mm:ss")</td>
       <td>$!comment.body</td>
   </tr>
   #end  
#end
</table>

For those, interested in details, have a look