Hi everyone,
this is a proposal to introduce a Like button in XWiki documents. The motivation behind this is to provide some more social engagement on XWiki pages. A design page has already been documented with some details about the usecases: https://design.xwiki.org/xwiki/bin/view/Proposal/Pagelikes
Note that to start the Like feature will be only implemented for Pages but there’s already a request to make Likes available for comments. This is important to be taken into account for development choices.
Here’s some ideas about the technical choices behind this feature.
Frontend
The main UI is a Like button allowing to perform a Like and displaying the number of Likes on the page.
Preliminary discussions about the feature led to put this button at the bottom of the Page content, next to the tags.
The design of the button itself is still in debate, some designs are proposed on https://design.xwiki.org/xwiki/bin/view/Proposal/Pagelikes#HButtondesignproposal and can be voted for on https://design.xwiki.org/xwiki/bin/view/XPoll/Like%20Button%20Design/
Along with this button, an interaction should be available to display the list of users who liked the page. I propose to use a modal available when clicking on the button to display clearly this information.
And so I also propose a configuration mechanism allowing to chose which kind of behaviour should be available when clicking on the button:
- immediately like when clicking and open the modal once like (with a possibility to unlike from the modal)
- open the modal when clicking, and display the possible action on the modal (like if not liked already else unlike)
- never open the modal (so never be able to see the list of likers) and always perform action when clicking: immediately like if not, or unlike with a confirmation if already liked.
Besides this button, a new UI should appear in User Profile to display the list of pages liked.
This UI will take the form of a new dedicated entry in the User Profile Menu leading to a table listing the Liked pages.
Finally, the page indexes should also be able to display the Like numbers.
Backend
Likes as Ratings
Some preliminary discussions about that feature led to the idea of reusing the Ratings for storing Likes.
This has pros and cons.
Pros:
- Ratings extension already exist so we can reuse already existing APIs
- it’s a feature request to be able to migrate existing Ratings to Likes with a provided threshold (e.g. Ratings > 3 are considered as a Like)
Cons:
3. the Ratings extension is not exactly in good shape: it’s very badly tested and the existing store are not really scalable
4. Ratings and Likes are not exactly the same thing: for Ratings the idea is to always display in the UI an average number of Ratings, while for Like we want the exact number of Likes. Besides that depending of the configuration we might want to retrieve the full list of likers or not when displaying the button.
RDBMS vs NoSQL
Besides the question of using Ratings or not for storing Likes, there’s also the question of storing Likes in a NoSQL DB, or in XWIKI standard DB.
First choices
As a start, I first implemented a Like based on Ratings and for scalability purpose I introduced a dedicated Solr Store for ratings.
This will allow:
- to migrate easily Ratings to Like
- to be scalable for the Like storage which can be quickly very large