There is 1 comment.
 
 
XWiki Platform / cid:jira-generated-image-avatar-9a024b02-55d9-491e-93e3-ba36d4eec3ef XWIKI-22754 Open

Use noavatar.png instead of noavatargroup.png for non-existing groups in macros.vm

 
View issue   ยท   Add comment
 

1 comment

 
cid:jira-generated-image-avatar-d7f1dd69-d282-41de-a86d-0c803e6593c3 Nikita Petrenko on 10/Apr/25 14:53
 

I think, update on this issue is needed - remove Trivial from Difficulty entry, so this issue won't be listed in Paper Cuts.

Because, current code logic can't identify non-existent group. It fails because due check

$profileDoc.getObject('XWiki.XWikiGroups')

. I thought and tested by introducing

$profileDoc.isNew()

before the original if statement. For a new document equal as non-existent group, this check always fails, leading it to incorrectly result the else case (user default avatar).

Michael Hamann suggested

pass additional information or to introduce a Velocity macro

getGroupAvatarURL

that only handles groups and could be called for fields that only allow groups.

Adding new parameter to current macro will raise extra refactoring. Introducing new macro - I'm not sure how could it be implemented as API doesn't have method to check whether group exist or not, with user it's easy

$services.user.exists($username)