Add comments to wiki pages

Description

The AddCommentMacro allows for easy addition of comments to a page, in a standard format. Each comment added is in the following form:

==== Comment by <user> on <date> ====
<comment-body>

The comment body supports normal TracWiki WikiFormatting.

Comments are added after the first line that starts with [[AddComment]].

The AddCommentMacro supports previewing and adheres to the TracPermissions scheme, only allowing comments to be added if the user has write access to the page.

Since [21] the AddCommentMacro can fulfill the role of an append only Wiki page. By passing the argument appendonly to the macro, comments can be appended to the page even when the user does not have permission to modify the page. Potentially unsafe, but can be useful.

Bugs/Feature Requests

Existing bugs and feature requests for AddCommentMacro are here.

If you have any issues, create a new ticket.

Install

Easy Install instructions for installing latest versions of the macro:

Trac 0.10.x

$> easy_install http://trac-hacks.org/svn/macropostplugin/0.10
...
$> easy_install http://trac-hacks.org/svn/addcommentmacro/0.10
...
Done.

Trac 0.11.x

$> easy_install http://trac-hacks.org/svn/macropostplugin/0.11
...
$> easy_install http://trac-hacks.org/svn/addcommentmacro/0.11
...
Done.

Trac.ini

Don't forget to add:

  • macropost.web_ui.macropostmodule = enabled
  • addcomment.* = enabled

to the [components] section of trac.ini, or use the WebAdmin interface to enable both plug-ins

Download

AddCommentMacro for 0.8.
AddCommentMacro for 0.9.
AddCommentMacro for 0.10.
AddCommentMacro for 0.11.
Download as a zip file here.

Requirements

You need to install MacroPostPlugin first, or the 'preview' and 'submit' buttons won't work.

Source

You can check out the source for AddCommentMacro from Subversion at http://trac-hacks.org/svn/addcommentmacro.

Change Log

[3887] by osimons on 06/23/08 12:58:56

AddCommentMacro:

  • Wiki page preview got us a double set of editing toolbars. Fixed.
  • Also adding some extra logging and deleting the redirect marker in search of possible issue with redirect (that I can't replicate).

[3723] by osimons on 05/27/08 21:20:18

AddCommentMacro: Now calls wiki page manipulators to check content before saving. This means support for Spam Filter plugin and similar plugins that can veto any wiki page change.

Report and patch by Thomas Moschny. Closes #3076.

[3204] by osimons on 02/10/08 09:54:25

AddCommentMacro: Unicode page name fix.

Should close #2547

[3027] by osimons on 01/11/08 03:07:03

AddCommentMacro: Warning + req.redirect() issues fixed.

The macro used the first version warning style (req.warning()), but that was just a left-over from before moving to redirect on successful submit anyway - it would not have displayed to the user no matter what. The line is just removed. Fixes #2368.

The whole req.redirect() idea needed to be reworked as macros cannot really do redirects. A redirect raises RequestDone, and like all other exceptions from macros it gets swallowed by the Formatter - causing an AssertionError to appear in the logs when the request tries to write a second status/header/response output later.

The exception did not display to the user, but was annoying... Now the redirect sets a marker on the req object, and by implementing IRequestFilter it now re-raises the RequestDone there.

[2818] by osimons on 11/24/07 04:47:33

AddCommentMacro: Adding form_token and more readable permissions in code.

References #1614

[2817] by osimons on 11/24/07 01:44:40

AddCommentMacro: Fixing some unicode issues with 0.10 version.

Fixes #766

Author/Contributors

Author: athomas
Contributors: eblot (ported Trac to trunk), osimons (0.11 version)