Type: New Feature
Status: Development in progress
Affects Version/s: 4.0
Fix Version/s: None
Pull from Repository:
Pull Master Branch:comment-api
Pull Master Diff URL:
The current Comment API is quite old and some important features are missing. We (TU Berlin) would like to implement a new Comment API for Moodle 4.0.
We are thinking of the following (new) features:
- Plugins have to define their comment areas in db/comments.php.
- Two possible comment structures (plugin defines which one to use): flat (all replies are below the other as it is currently) or question/answers (replies are indented and associated with a parent comment).
- Possibility to comment under a pseudonym. A plugin defines whether pseudonyms are allowed or if the user is even forced to comment under a pseudonym (e.g. mod_assign could force pseudonyms when the grader identity is hidden from students, cf. MDL-66987).
- A plugin has to implement a class that represents one comment section (i.e. a context, component, comment area, item id) and that controls the permissions and enabled features.
- Notifications: Users can (un)subscribe to a comment section, to a comment (getting notified when there are replies to a certain comment), to all comment sections (all itemids) within a (context, component, area). And maybe even (un)subscribe to all comment sections of a course?
- Users can decide if they want to be notified immediately or in a daily digest.
- Plugin optionally defines which users should be notified by default (e.g. mod_assign could notify the grader by default when a student comments the grade).
- Users can view the newest comments in all comment sections (all itemids) within a (context, component, area). Maybe even the newest comments in (all contexts in a course, component, area)?
- Permalink to a comment and link to the page that the comments (within an area and itemid) belong to.
- Allow users to edit their comments within $CFG->maxeditingtime.
- Comments can be upvoted with a thumbs up (in order to avoid simple comments like "+1") and a thumbs up counter is displayed. Users can undo their upvote. Plugins may disable votes.
- Possibility for a plugin to add custom/meta data (JSON) to a comment (for example, a video plugin could add the point in time in the video that the comment refers to).
- In addition to the existing capabilities (moodle/comment:delete, moodle/comment:post and moodle/comment:view) we want to add: moodle/comment:editany and moodle/comment:postpseudonym
The old API should be deprecated and removed in Moodle 4.4.