Extension:CommentStreams/en

CommentStreams is a commenting system for wikis. Users can post comments below the content on a wiki page. The comments are displayed with the user's username, linked to their user page if it exists, the creation and last modification dates of the comment, and an optional user avatar. Comments can be edited and deleted only by the comment author. Comments are added in streams which include a title and a head comment that can be replied to by other comments.

CommentStreams does not depend upon any other extensions, but it provides several additional features if some other extensions are installed:


 * If is installed, web and email notifications are sent to users who have enabled them when comments are added on pages the user is watching or replies are posted to comments authored by the user.


 * If is installed, optional, user-configurable properties to set an avatar and display name for a user as well as special properties that can be queried on each comment to provide the comment title, a link to the page to which the comment refers, and a link to the head comment if the comment is a reply.


 * If both and  are installed, editing of comments will be done using VisualEditor.

CommentStreams stores comments on pages in the CommentStreams namespace. These pages are given a randomly-generated string of characters as the name. Users cannot edit or delete these pages directly. A database table stores the comment title and IDs of the page to which the comment refers and the page containing the head comment if the comment is a reply.

Upgrading to Version 7.0 or later
Two major changes were added in Version 7.0 that require special care upon upgrading:


 * change to the database schema
 * change to the way comment block ids are stored

The change to the database schema requires that you first upgrade to version 6.3 if you are running an earlier version and then upgrade to version 7.0.

With respect to comment block ids, in versions prior to 7.0 the  column of the   table stored the MD5 hash of the comment block name prepended by ' ' with the exception of the default comment block, which is designated by ' ' in the   column. This made it extremely difficult to maintain comment blocks. If a comment block was renamed in wikitext, there was not an easy way to identify which rows needed to get adjusted.

Version 7.0 replaces the value in the  column with null for the default comment block and with the name of the comment block (unhashed) for named comment blocks. It no longer uses the comment block name as an id for the element in the DOM. Version 7.0 includes three maintenance scripts that can be used to update the database and to move comments between comment blocks:


 * is run on upgrade by  to null out the   column for rows that previously were set to ' ' (the default comment block). You should not need to run this script directly, as it is run by.


 * lists all of the comment blocks either across the entire wiki or, with the ' ' option, sorted by the page they appear on.


 * takes the unhashed name of a comment block and either replaces  with the unhashed name for all rows that currently hold ' ' followed by the hashed name - or - takes both a from name and a to name to rename any comment block.

To upgrade from previous versions of CommentStreams to version 7.0 or later,
 * takes an (unhashed) comment block name and migrates all comments in the default comment block to the new comment block name.
 * If the version is older than 6.3, upgrade to version 6.3 and run.
 * Upgrade to version 7.0 and run.
 * If your wiki contains named comment blocks, use the  script to rename them in the database. You can use the   script to see which comment blocks exist in the database currently.

Semantic MediaWiki support
If is installed, CommentStreams defines the following properties on each comment page, which can be used to query for comments:

CommentStreams namespace
You can use the MediaWiki search box to search for comments. In the search result page, the page that the comment appears on, rather than the comment page in the CommentStreams namespace, appears in the search results. While it is possible to visit comment pages directly in the CommentStreams namespace, for example if they are listed in Special:RecentChanges, this is not encouraged. Editing, deleting, and moving comment pages by visiting them in the CommentStreams namespace is disabled. Instead editing and deleting comments is done from the content page on which the comment appears.

Enabling and disabling comments on a page
CommentStreams also offers two tag functions, and.

enables CommentStreams on a page even if it is in a namespace in which comments are disabled. Optionally, an id for the comment block may be provided:.

disables CommentStreams on a page even if it is in a namespace in which comments are enabled.

If both of these tag functions exist on a page, the last one parsed will win.

Multiple comment blocks on a page
If you want to place more than one comment block on a page, you can use  with a different unique id in each tag. If a comment block with an id (also referred to as a named comment block) appears on the page, the default comment block (the comment block with no id) will not appear unless appears in the wikitext of the page.

Placement of comments
The default comment block (the comment block with no id) will always be placed at the bottom of the page below the categories. (Note that this is a change from prior to version 7.0 where the default comment block would appear on the page where it appeared in the wikitext. The earlier behavior caused complications in namespaces where comments were not enabled by default.)

Named comment blocks (those with a unique id) will appear on the page where they appear in the wikitext. If you have only one comment block on a page that you want to place specifically, you can also use

Initially collapsed CommentStreams
CommentStreams also offers a tag function,, which makes comments appear initially in a collapsed state (only the comment header with the comment title, author, dates, and buttons showing) on a page. This tag function has no effect if comments are disabled on the page.

Comment right
If no groups are assigned the  right, then all users who have the   right are allowed to post and reply to comments. The  right can be assigned, for example, to the group   by setting

If you use the LockDown extension, you might want to use this to prevent access to the Special page that shows all comments:

Anonymous comments
It is possible to enable anonymous comments by setting

Anonymous commenters are warned that their IP address will be recorded if they post or reply to a comment and that they will not be able to edit or delete their comments after they are submitted. While these comments show anonymous as the author on the page where the comment appears, the author's IP address does appear in the comment log and comment page history.

Echo support
For a user to receive Echo notifications by web or email, the Echo extension must be installed and echo notifications must be enabled for that user. To enable CommentStreams Echo notifications by default for all users on a wiki, the following configuration should be used:

Users may edit their notification settings by visiting the page.

Notifications will be sent to a user when another user posts a new comment or a reply on a page the first user is watching. Notifications will also be sent to a user when another user posts a reply to a comment the first user is watching. A user can watch a comment by clicking on the star on the comments title bar. Clicking on the star again will remove the comment from the user's comment watchlist. When a users posts a new comment, it will automatically be added to the user's comment watchlist.

If it is taking a long time to create or reply to a comment with Echo enabled, you can have the Echo event creations done on the job queue (see ), by setting the following:

Comment moderation
A group (csmoderators) and two new rights (cs-moderator-edit and cs-moderator-delete) exist to support comment moderation. By default, members of csmoderators have the csdelete right (they may delete any comment) but they do not have the cs-moderator-edit right (they may not edit any comment). Those rights may be assigned to other groups or changed. In addition, the  configuration variable makes it easy for moderators to quickly delete entire comment threads. For example:

As an aid in comment moderation, the special page  lists all comments in reverse chronological order of when they were last edited.

Avatar
If the Social Profile extension is installed, avatars set for users will be displayed beside the comments and replies they author. If the Social Profile extension is not installed but the Semantic MediaWiki extension is installed, the  configuration variable can be used to specify avatars.

Version history

 * Version 8.0-dev (master branch)
 * Automatic export of comments/replies when the page they are associated with is exported
 * Drop support for MediaWiki 1.37 and earlier
 * Version 7.2 (REL1_37 branch)
 * Fix SMW initialization error
 * Version 7.1
 * Display time using preferred timezone for logged in users
 * Version 7.0
 * Remove $wgCommentStreamsEnableTalk option
 * The treatment of talk namespaces as a special case has always been confusing. The $wgCommentStreamsEnableTalk option is unnecessary, since talk namespaces can be explicitly included in $wgCommentStreamsAllowedNamespaces, and it only adds confusion to the logic and the configuration documentation.
 * Drop support for MediaWiki 1.34 and earlier
 * Convert to OOUI
 * Stop MD5 hashing comment block ids so they can be referred to by name (see notes above on upgrade from previous versions)
 * Convert to abstract database schema and split comments and replies in database
 * Add initial support for Special:Export/Special:Import of comments and replies (you must explicitly list the comment pages by name; support for automatically exporting comments when the page they are commenting on is exported will come in version 8.0 with MediaWiki 1.38)
 * Version 6.3 (REL1_35 and REL1_36 branches)
 * Fix bug in MW 1.36+ where Special:AllComments was failing since last editor was defined to be User rather than a UserIdentity in Comment
 * Fixed new CI error where commentTitle was undefined for replies in CommentStreams.js
 * Version 6.2
 * Fix bug that prevented comments being displayed when  was non-null
 * Fix bug that resulted in a Type Error when trying to add a comment with title "0" with Echo enabled
 * Remove injection of unused services
 * Remove invisible limit report and parser output div from parsed comments
 * Version 6.1
 * Fix next/previous buttons on Special:AllComments
 * Version 6.0
 * Code refactoring
 * Add  flag to enable/disable search
 * Version 5.0
 * Added support for multiple comments blocks in a page using
 * Version 4.7
 * Fixed bug with voting buttons
 * Restored support for MediaWiki 1.31 again
 * Version 4.6
 * Restored support for MediaWiki 1.31
 * Fixed issue with access to mw.user in CommentStreams.js
 * Fixed button hover behavior


 * Version 4.5
 * Added support for


 * Version 4.4


 * Modified to insert comment at location of tag; previous behavior of locating comment at the bottom of the page can be retained with


 * Version 4.3.1


 * Sanitized comment wikitext before passing back to the browser to avoid future XSS vulnerability.


 * Version 4.3
 * Added


 * Version 4.2
 * Fixed Special:AllComments for comments beginning with a '+'
 * Added optional button label and $wgCommentStreamsShowLabels
 * changed DB_SLAVE to DB_REPLICA, requiring MediaWiki 1.30+

Also named table columns correctly on table creation rather than create them with the old names then rename them. If you are updating from an earlier version, you will need to run the maintenance update script. This also fixes issue for wikis that use database table prefixes. If you are updating from an earlier version, you will need to run the maintenance update script.
 * Version 4.1
 * Removed foreign key from comment data table as it was causing issues deleting pages with comments on them for some database versions.
 * Version 4.0
 * Renamed the database columns to avoid conflicts with other table column names.


 * Version 3.10
 * Added optional capability to allow anonymous comments
 * Suppress comments on redirect pages
 * Bug fix: fatal error for comments on deleted pages on Special:AllComments
 * Bug fix: SQL for update script didn't include support for table prefixes


 * Version 3.9.1
 * Bug fix: syntax errors in JavaScript that affected IE


 * Version 3.9
 * Bug fixes: deletion of comments with replies and missing notifications on watched comments


 * Version 3.8
 * Get avatar from SocialProfile extension if it is installed
 * Reworked user interface
 * Added comment watchlist and reworked notifications


 * Version 3.7
 * Added
 * Added  type to   and adding logging of comment page creations, deletions and edits to
 * Suppressed comment page creations, deletions, and edits from
 * Fixed missing subtitle on comment pages


 * Version 3.6
 * Added permalinks
 * Fixed bug prevention comment deletion
 * Added Semantic MediaWiki properties for vote counts
 * Added error messages for disallowed actions on comment pages


 * Version 3.5
 * added comment voting
 * requires a database update if voting is enabled
 * fixed several bugs:
 * handling of the delete button in certain pathological cases
 * print out an error message if the user has been logged out (either a timeout or logout from a different window)


 * Version 3.4
 * Added comment moderation


 * Version 3.3
 * Fixed database update bug


 * Version 3.2
 * Fixed reply bug


 * Version 3.1
 * Fixed Semantic MediaWiki dependency bug


 * Version 3.0
 * Echo supported added
 * Echo extension must be installed to enable Echo notifications; if Echo is not installed, CommentStreams continues to function without notifications
 * if Echo is installed, minimum required MediaWiki version is 1.27
 * if Echo is not installed, minimum required MediaWiki version is 1.25
 * use OOjs UI for dialogs


 * Version 2.1
 * added delete "are you sure?" dialog box
 * use jquery.ui.dialog for dialogs
 * set text field focus when editing and creating comments


 * Version 2.0
 * refactored
 * simplified configuration
 * localized strings
 * made comments and comment titles searchable
 * added comment modification date
 * added optional user avatar
 * made EditOwn unnecessary
 * fixed JavaScript deprecation warning
 * fixed SQL file path bug
 * added
 * protected comment pages from being directly edited or deleted


 * Version 1.0
 * initial version

Known issues

 * If you are enabling CommentStreams with Semantic MediaWiki, you must load CommentStreams before enabling Semantic MediaWiki.
 * If CommentStreams is used on a page which uses, and a comment is posted which transcludes another page using HeaderTabs, the JavaScript on the page breaks.
 * Workaround: Don't transclude pages with HeaderTabs onto pages with HeaderTabs.
 * CommentStreams is not compatible with.
 * CommentStreams is not compatible with