Clean Activity Stream
Last modified by Vincent Massol on 2024/07/05 14:31
A form to remove events from the Activity Stream |
Type | XAR |
Category | Application |
Developed by | |
Rating | |
License | GNU Lesser General Public License 2.1 |
Table of contents
Description
By default the Activity Stream is displayed on the front page of XWiki and sometimes there's a need to remove some entries from it (someone modifying a page with some rude language comment, creating/deleting a page that we don't want to show in the stream, etc).
This application allows removing some specific events from the Activity Stream.
Form to delete selected events
Result
Notes
- The form is installed in Sandbox by default but it is an admin tool, once installed you can move page in a space of your choice
- The form shows only last 500 events by default
- After event deletion you must refresh the page to update the list displayed by the form (deleted event still show up in the list prior to refresh)
- Old Activity Stream events can be removed using the cleanup parameters that exists in the xwiki.cfg configuration file:#-# Number of days the events should be kept (0 or any negative value: infinite duration)
#-# Note: if this value is greater than 0 a scheduler job will be created, this job will then be fired every week to
#-# delete events older than the configured value.
#-# Default: 0
# xwiki.plugin.activitystream.daystokeepevents=0
Prerequisites & Installation Instructions
Download/install
xar extension and move page in a space of your choice OR- Copy/paste this code below in a page:{{velocity}}
=Form to delete manually some events entries from Activity Stream =
Select events below (last 500) and click on button to delete them
#if ($xwiki.hasAdminRights())
{{html}}
<form method="get" id="DelActivityStream" onsubmit="return confirm('Delete selected events: are you sure?')">
<div class="container">
## List 500 last events
#foreach ($MyEvent in $xwiki.activitystream.getEvents(false, 500, 0 ))
#set($MycheckBox="<input type='checkbox' name='IdEntry' value='")
#set($MycheckBox=$MycheckBox + "$MyEvent.getEventId()")
#set($MycheckBox=$MycheckBox + "'/>" + "$MyEvent.getDisplayDate() - $MyEvent.getPage() - $MyEvent.getType() - - $MyEvent.getUser() " + "<br />")
$MycheckBox
#end
</div>
<span class="buttonwrapper"><input type="submit" value="Delete selected entries from Activity stream" class="button"/></span>
</form>
{{/html}}
#else
{{warning}}
You must login with an administrator account.
{{/warning}}
#end
## Get selected events ids
## formatting to use data in next hql query: act.eventId in ( 'xxx-yyyyy', 'another-ide', 'etc' )
#set($ListIn = $stringtool.join($request.getParameterValues('IdEntry'), "', '"))
#set($ListIn = "'" + $ListIn + "'")
## Get selected events object
#set($results= $xwiki.activitystream.searchEvents("act.eventId in ($ListIn)", false, 0, 0))
## loop on theses events and delete them
#foreach ($MyEventToDelete in $results)
$xwiki.activitystream.deleteActivityEvent($MyEventToDelete)
* $MyEventToDelete.getDisplayDate() - $MyEventToDelete.getPage() - $MyEventToDelete.getType() - - $MyEventToDelete.getUser() ~*~* //**deleted**// ~*~*
#end
{{/velocity}} - Add this XWiki.StyleSheetExtension object on the page:.container {
border:2px;
solid #ccc;
width:800px;
height: 300px;
overflow-y: scroll;
margin-left: unset;
}