Hello all,
Currently, the notifications mechanism of XWiki allows to display notifications and to mark them are read.
To increase the interactions on the notifications, I propose to allows developers to declare quick actions for the notifications event.
A quick action takes the form of a icon displayed at the bottom of an event in the notification pane, and triggers an action when clicked on.
For instance, liking the document linked to the notification, on opening a modal to quickly answer to an event.
Visually, the quick action takes to the form of clickable icons displayed at the bottom of the notifications, and are visible in the notification pane and in the activity stream.
Proposed architecture
The proposed architecture follows the existing mechanism used to declare custom displayer for the notifications using Notifications.Code.NotificationDisplayerClass
XObjects.
I propose to introduce the Notifications.Code.NotificationQuickActionDisplayerClass
, with two fields:
- Event Type: Declares the name of the event for which the quick action must be displayed.
-
Template: the template used to display the quick action.
This class is bound to aWikiQuickActionDisplayer
role using aWikiBaseObjectComponentBuilder
to register the declaredNotificationQuickActionDisplayerClass
objects.
The template form is not constrained but the good practice should be to display simple clickable icons, possibly complemented by a short text (for instance, the number of likes of the event).
Clicking a quick action should either directly trigger the action, or open a modal screen with a larger UI.
Impacts on xwiki-platform-notifications-notifiers-api
- new
NotificationQuickActionRenderer
role: render the quick actions of an event - new
DefaultNotificationQuickActionRenderer
class (implements NotificationQuickActionRenderer). Loop over the registered quick actions that matches the current event and render them. The results of the rendering of the different quick actions are grouped on a div. - A new
Block renderQuickActions(Event event)
method inNotificationNotifiersScriptService
called fromtemplates/notification/macros.vm
to display the quick actions.
A newNotificationQuickActionDisplayer
role, in charge of the display of a single event quick action.
Impacts on xwiki-platform-notifications-notifiers-default
-
WikiNotificationQuickActionComponentBuilder
register theWikiQuickActionDisplayer
from theNotifications.Code.NotificationQuickActionDisplayerClass
XObjects -
WikiNotificationQuickActionDocumentInitializer
create theNotifications.Code.NotificationQuickActionDisplayerClass
XClass -
WikiQuickActionDisplayer
implementsNotificationQuickActionDisplayer
Impacts on xwiki-platform-web
:
- New call to
$services.notification.notifiers.renderQuickActions($event)
on the event displaying loop oftemaplates/notification/macro.vm
The quick actions are current not displayed in the mails and the rss feeds.
WDYT?