A patch to make the module work with Diff

Nearyan - August 25, 2009 - 14:38
Project:GB Comment Revisions
Version:6.x-2.x-dev
Component:Code
Category:task
Priority:normal
Assigned:Unassigned
Status:needs review
Description

Hello,

I've written a patch to make Comment Revisions work with Diff. When clicking on the 'view revisions' link at the bottom of a comment, a form gets shown in which you select two revisions for comparison. Then when you click on the 'Show diff' button, they appear side by side on the screen, highlighting the differences between them, and showing the latest revision (properly filtered and themed) at the bottom. For a preview, you can take a look at the demonstration of the Diff module, since this patch will add nearly identical functionality for comments.

Other things that this patch does:

  • It redefines the url-structure of the module to be as similar as possible to that of nodes. In addition, it removes and adds some permissions, changes the meaning of some, and it renames all of the rest, in order to be more understandable and to fix #336022: Node revision permission hidden when this mode is enabled - see the README.txt for an explanation of what the permissions do.
  • It incorporates linksunten's patch, which introduces the concept of hidden revisions (although it was named 'stashed' in their patch). When you mark a revision as hidden, users without the 'view hidden comment revisions' permission won't be able to see it.
  • It removes some of the settings of the module from admin/settings/commentrevisions because they didn't actually do anything.
  • It also addresses #276937: Delete current revisions (by disabling the possibility to delete the current revision).
  • All of the code now conforms to the Drupal conventions - or at least as far as I and the Coder module know them.

Installing the patch:

  • Before installing this patch, make sure you have Diff installed and enabled. (And the comment module.)
  • Because this patch adds the hiding functionality, you need to run update.php after installing it - even if you already had linksunten's patch installed.

When writing this patch I was before I knew it rewriting nearly all of the original code, so I've uploaded it as a zip instead of as a diff, for convenience. This is the first thing I've written for Drupal, so if I screwed up somewhere, be gentle! :)

AttachmentSize
comment_revisions.zip17.99 KB
 
 

Drupal is a registered trademark of Dries Buytaert.