This issue has been created
 
 
XWiki Platform / cid:jira-generated-image-avatar-98543bac-8612-4e0b-9f7d-334d16d0d507 XWIKI-25583 Open

Report a missing user or icon in the displayIcon, mention and useravatar macros instead of falling back silently

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-a3b9e93e-30c4-43f4-947a-9406bf51d0aa Charpentier Lucas created this issue on 23/Oct/26 17:13
 
Summary: Report a missing user or icon in the displayIcon, mention and useravatar macros instead of falling back silently
Issue Type: cid:jira-generated-image-avatar-98543bac-8612-4e0b-9f7d-334d16d0d507 Improvement
Affects Versions: 17.10.14, 18.8.0
Assignee: Unassigned
Components: Icon, Mentions, User
Created: 23/Oct/26 17:13
Priority: cid:jira-generated-image-static-major-c794aac4-966d-4623-90e5-be1054e71c5c Major
Reporter: Charpentier Lucas
Description:

These macros display a user or an icon named by a parameter. When the user or the icon does not exist, they silently fall back to a default, or render nothing, so the page shows a wrong result and the user is never told that the name is wrong.

The macros to change, with the file where most of the fix is done:

The main problems:

  • displayIcon: an unknown icon name, or a Font Awesome name like fa-home, renders an empty paragraph; an unknown icon set, or one in the wrong case, silently gives the icon of the default theme, and nothing at all with fallback="false".
  • mention: a reference to a user that does not exist, a display name or a page renders a link to a missing page, and an empty reference mentions the current space.
  • useravatar: a username that is not a user gives the default avatar, and a width or height like "50%" or "40px" gives width="0", so the avatar disappears.

The fix is to check that the user or the icon exists and to show an error naming the parameter when it does not, at least in the editor.

Depends on

  • XCOMMONS-3847, which refuses the boolean and number values that do not convert.
  • XRENDERING-823, which makes the error of an invalid parameter name the parameter and the expected value.

KOs covered

Macro Criterion Problem
displayIcon E2 errors {{displayIcon name="nosuchicon"/}}, name="fa-home" and name="" render an empty paragraph, iconSet="NoSuchSet" and iconSet="silk" silently give the Silk icon, and fallback="false" then renders nothing, all with no message. Partly covered, see below.
mention E2 errors reference="XWiki.NoSuchUser" and reference="John Doe" render a link to a page that does not exist, reference="Main.WebHome" mentions a page, reference="" renders the current space, and anchor="my anchor" gives an invalid HTML id. Partly covered, see below.
useravatar E2 errors width="abc", "50%" or "40px" gives width="0", so the avatar disappears, negative sizes are output as is, and a username that is not a user silently gives the default avatar. Partly covered, see below.

Impact found on macro fluidity

These 3 KOs come from the WYSIWYG usability audit of the macros, under the criterion E2 errors of its usability criteria, which asks that an invalid parameter value produces a message that says what is wrong and how to fix it, not a stack trace. The page of each macro, linked in the table, has the full notes and the steps to reproduce.

Each of these KOs is only partly covered here, for the problems specific to the macro. The same KOs also report invalid values that the macro system handles for every macro: XCOMMONS-3847 refuses the booleans and numbers that do not convert, and XRENDERING-823 makes the error name the parameter and the expected value. The type and style of mention are covered by XWIKI-25504.