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.
The proposed architecture follows the existing mechanism used to declare custom displayer for the notifications using
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 a
WikiQuickActionDisplayerrole using a
WikiBaseObjectComponentBuilderto register the declared
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.
NotificationQuickActionRendererrole: render the quick actions of an event
DefaultNotificationQuickActionRendererclass (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 in
templates/notification/macros.vmto display the quick actions.
NotificationQuickActionDisplayerrole, in charge of the display of a single event quick action.
- New call to
$services.notification.notifiers.renderQuickActions($event)on the event displaying loop of
The quick actions are current not displayed in the mails and the rss feeds.