Rewriting the Comment API

Rewriting the Comment API

by Lars Bonczek -
Number of replies: 0

The current Comment API is quite old and some important features are missing. We (Martin Gauk, Lars Bonczek) started working on a new Comment API two years ago to replace the current one. Our progress is tracked in MDL-71935. After we got distracted from this project due to other responsibilities, we would now like to recommence it with your help.

New features we have already implemented:

  • Comments are rendered client-side using Mustache templates and Moodle's Reactive UI
  • Comments can be posted as replies to other comments
  • Users can edit their comments within $CFG->maxeditingtime
  • Comments can be posted using the pseudonym "Anonymous" (this will be replaced by User Disguises when they are available)
  • Plugins can add custom metadata to comments (for example, a video plugin could add the timestamp that the comment refers to)
  • Comments can be displayed in a modal popover if there is not enough space on the page
Screenshot of the current UI (a modal popover in this case):

Screenshot von einem Modal mit einem Kommentarbereich

Additional features we want to implement:

  • Upvotes (it has been suggested that we use the Rating API for this)
  • Notifications (some digest logic is required; users should be able to subscribe and unsubscribe from notifications)

What we need help with:

  • Feedback on the new features, especially the UI
  • Expertise on Core APIs like the Rating API, the Message API and Moodle's Reactive UI
  • Development of Behat and PHPUnit tests