I need to be able to view all the comments on an issue, with the date and author in a scripted field.
I was trying to play around with this but could not figure out how to get it to work for all comments:
import com.atlassian.jira.component.ComponentAccessor
def user = ComponentAccessor.jiraAuthenticationContext.getLoggedInUser()
def commentManager = ComponentAccessor.getCommentManager()
def rendererManager = ComponentAccessor.getRendererManager()
def comments = commentManager.getCommentsForUser(issue, user)
if (comments) {
def commentAuthor = comments.last().getUpdateAuthorFullName()
def commentDate = comments.last().getUpdated()
def commentBody = rendererManager.getRenderedContent("atlassian-wiki-renderer", comments.last().body, issue.issueRenderContext)
return "<p><span style=\"font-size:smaller;color:#a9a9a9;font-style:italic\">" + commentDate.format('YYYY-MM-dd') + " | " + commentAuthor + commentBody + "</span></p>"
}
Can anyone help?