Details
-
Bug
-
Resolution: Fixed
-
Major
-
2.3
-
None
Description
Problem
In ReleaseNotes.Code.Change.ChangeDisplayerVelocityMacros, the displayScreenshots macro documents that when alwaysDisplayScreenshots is true it must "only display the 1st video if there are more than one". The guard meant to implement that tests $alwaysDisplayScreenshot – singular, missing the trailing "s" – which is never defined anywhere. An undefined reference evaluates to false in Velocity, so the #else branch always runs and every video is displayed.
#if ($alwaysDisplayScreenshot && $videoReferences.size() > 0) #set ($computedVideoReferences = [$videoReferences.get(0)]) #else #set ($computedVideoReferences = $videoReferences) #end
The parameter name is spelled correctly in the other four places it appears in the same macro, so this is a plain typo rather than an intentional second flag.
How to reproduce
- Create a change with two video attachments and no screenshot, listing both in its screenshots field.
- Render it with a displayer that passes alwaysDisplayScreenshots = true.
- Expected: one video (the first). Actual: both videos.
Verified on XWiki 18.6.0 with the grid displayer: the rendered card contains two <video> elements whether the parameter is true or false, so the parameter has no effect at all on the number of videos.
Notes
- Introduced by the fix for
RN-67, so present since 2.3. - The grid displayer is currently the only caller passing true, which is why the deviation has gone unnoticed.
- Fixing the typo changes rendering for any change carrying several videos and no screenshot, so it deserves its own issue rather than riding along with an unrelated change.