Index: wiki/src/main/resources/Main/RecentActivity.xml =================================================================== --- wiki/src/main/resources/Main/RecentActivity.xml (revision 32689) +++ wiki/src/main/resources/Main/RecentActivity.xml (working copy) @@ -881,6 +881,7 @@ #set($isAnnotationUpdateRelatedEvent = false) ## TO DO - remove this variable after fixing XWIKI-5632 #set($isConsecutiveUpdateEvent = false) #set($isRelatedAttachmentEvent = false) + #set($isCreateOrDeleteRelatedEvent = false) ## ## Get consecutive 'update' events having the same user (-> only the latest such event will be taken in account) ## --------------------------------------------------------------- @@ -893,7 +894,7 @@ ## ## TO DO - remove this test after fixing XWIKI-5632 ## --------------------------------------------------------------- - #if($xwiki.activitystream.getRelatedEvents($event).size() > 1) + #if($xwiki.activitystream.getRelatedEvents($event).size() > 1 && $event.type == 'update') #foreach($relatedEvent in $xwiki.activitystream.getRelatedEvents($event)) #if($relatedEvent.type == 'updateAnnotation') #set($isAnnotationUpdateRelatedEvent = true) @@ -909,10 +910,20 @@ ($event.type == 'addAttachment' && $event.requestId == $previousEventInNewList.requestId))) #set($isUpdateOrAddAttachmentRelatedEvent = true) #end + ## Get 'create' and 'delete' related event (-> in order to remove duplicated events in the case of import, rename, delete page) + ## --------------------------------------------------------------- + #if($xwiki.activitystream.getRelatedEvents($event).size() > 1 && $event.type != 'create' && $event.type != 'delete') + #foreach($relatedEvent in $xwiki.activitystream.getRelatedEvents($event)) + #if($relatedEvent.type == 'create' || $relatedEvent.type == 'delete') + #set($isCreateOrDeleteRelatedEvent = true) + #end + #end + #end ## + ## ## Build the clean event list ## --------------------------------------------------------------- - #if(!$isConsecutiveUpdateEvent && !($event.type == 'updateAnnotation') && !$isUpdateOrAddAttachmentRelatedEvent && $newList.size() < $aSubEntries) + #if(!$isConsecutiveUpdateEvent && !($isCreateOrDeleteRelatedEvent && $event.type != 'create' && $event.type != 'delete') && !$isAnnotationUpdateRelatedEvent && !$isUpdateOrAddAttachmentRelatedEvent && $newList.size() < $aSubEntries) #set($discard = $newList.add($event)) #set($previousEventInNewList = $event) #end @@ -986,17 +997,23 @@ *# #macro(displayComment $event) #set($pageDoc = $xwiki.getDocument($event.page)) - #set($pageDocRevision = $pageDoc.getDocumentRevision($event.version)) - <div class="comment"> - $!pageDocRevision.getObject('XWiki.XWikiComments', $util.parseInt($event.getParam2())).getProperty('comment').value - </div> + #if($xwiki.getDocument($pageDoc, $event.version)) + #set($pageDocRevision = $xwiki.getDocument($pageDoc, $event.version)) + <div class="comment"> + $!pageDocRevision.getObject('XWiki.XWikiComments', $util.parseInt($event.getParam2())).getProperty('comment').value + </div> + #end #end #** - * Display comment + * Display annotation *# #macro(displayAnnotation $event) - <div class="annotated">$xwiki.getDocument($event.page).getObject('AnnotationCode.AnnotationClass', $util.parseInt($event.param2)).getProperty('selection').value</div> - <div class="annotation">$xwiki.getDocument($event.page).getObject('AnnotationCode.AnnotationClass', $util.parseInt($event.param2)).getProperty('annotation').value</div> + #set($pageDoc = $xwiki.getDocument($event.page)) + #if($xwiki.getDocument($pageDoc, $event.version)) + #set($pageDocRevision = $xwiki.getDocument($pageDoc, $event.version)) + <div class="annotated">$pageDocRevision.getObject('AnnotationCode.AnnotationClass', $util.parseInt($event.param2)).getProperty('selection').value</div> + <div class="annotation">$pageDocRevision.getObject('AnnotationCode.AnnotationClass', $util.parseInt($event.param2)).getProperty('annotation').value</div> + #end #end #** * Display user avatar and action message @@ -1036,10 +1053,12 @@ #end #displayActivityListItemHeader(false false $isEventEntryExpandable) <div class="activityContent"> - #foreach($event in $xwiki.activitystream.getRelatedEvents($event)) - #isAttachmentEvent($event) - #if($isAttachmentEvent) - #displayAttachment($event) + #if($event.type == 'addAttachment') + #foreach($event in $xwiki.activitystream.getRelatedEvents($event)) + #isAttachmentEvent($event) + #if($isAttachmentEvent) + #displayAttachment($event) + #end #end #end #if($isCommentEvent && $event.type != 'deleteComment')