The issue come from `commentsinline.vm` and a part of the code introduced by XWIKI-22978 .
## Build a map on the form Date -> List<Comment object>
## We also keep the set of keys when we have multiple comments at same date just to order them later (it should be a
## very rare case but let's ensure we keep a deterministic order)
#set ($commentMap = $collectiontool.getSortedMap())
#set ($keysWithMultipleComments = $collectiontool.getSet())
#foreach ($comment in $comments)
#set ($key = $comment.date)
#if ($commentMap.containsKey($key))
#set ($discard = $commentMap.get($key).add($comment))
#set ($discard = $keysWithMultipleComments.add($key))
#else
#set ($discard = $commentMap.put($key, [$comment]))
#end
#end
The list is ordered by key and the line `#set ($key = $comment.date)` will set the list to be ordered by date. The issue here is `$comment.data` get a date as String (example : “23/11/2017 14:25:44”), and then the sortedMap see a String and will order as text.
1. Create multiple comments on the same document 2. Update the last comment date to be a day be a day before a previous comment, but also add one to the year, so the comment is still the last one (workd also with month) Result : The modified comment, is ordered by the day and become the first comment. Expected : As the year is higher, it must be the last one. |