Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Get avatar from comment

alffla97
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 24, 2020

Hi, 

I am trying to show a user's avatar when I go through all comments of an issue.

Here's an extract of my code:

#foreach($comment in $comments)
#set($adate = $comment.getCreated())
#set($adate = $date.format("dd MMMM yyyy HH:mm:ss", $adate))
#set($name = $comment.getAuthorFullName())
#set($text = $comment.getBody())
#set($CommentUser = $comment.getAuthorApplicationUser())
#set($user = $ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser())
#set($avatar = $ComponentAccessor.getAvatarService())
#set($avatarUrl = "")
#set($avatarUrl = $avatar.getAvatarURL($user, $CommentUser))
<fo:table-row border-bottom="thin solid #DDDDDD">
<fo:table-cell padding-top="3mm" padding-bottom="1mm">
<fo:block>
$CommentUser
</fo:block>
<fo:block>
$user
</fo:block>
<fo:block>
avatarUrl: $avatarUrl
</fo:block>
<fo:block>
<fo:external-graphic width="18px" height="18px" content-height="18px" content-width="18px" src="url($xmlutils.escape($avatarUrl))"/>
<fo:inline color="#0000FF">$name</fo:inline> added a comment - $adate
</fo:block>
<fo:block>
$pdfRenderer.asRendered($issue, "description", $text)
</fo:block>
</fo:table-cell>
</fo:table-row>
#end

 

$CommentUser and $user are both ok but $avatarUrl stays blank.

Please help.

Regards,

Alain

0 answers

Suggest an answer

Log in or Sign up to answer