diff --git a/_config.php b/_config.php index 16d4798..85a71c9 100644 --- a/_config.php +++ b/_config.php @@ -28,8 +28,4 @@ if(class_exists('SiteTree') && !Commenting::has_commenting('SiteTree')) { Commenting::add('SiteTree'); -} - -if(class_exists('ContentController')) { - ContentController::add_extension('ContentControllerCommentsExtension'); } \ No newline at end of file diff --git a/code/extensions/CommentsExtension.php b/code/extensions/CommentsExtension.php index 601a0ac..baffb25 100644 --- a/code/extensions/CommentsExtension.php +++ b/code/extensions/CommentsExtension.php @@ -8,13 +8,8 @@ class CommentsExtension extends DataExtension { - /** - * Adds a relationship between this {@link DataObject} and its - * {@link Comment} objects. If the owner class is a sitetree class - * it also enables a checkbox allowing comments to be turned off and off - */ public static function get_extra_config($class, $extension, $args = null) { - $config = array('has_many' => array('Comments' => 'Comment')); + $config = array(); // if it is attached to the SiteTree then we need to add ProvideComments if(is_subclass_of($class, 'SiteTree') || $class == 'SiteTree') { diff --git a/code/extensions/ContentControllerCommentsExtension.php b/code/extensions/ContentControllerCommentsExtension.php deleted file mode 100644 index af0e144..0000000 --- a/code/extensions/ContentControllerCommentsExtension.php +++ /dev/null @@ -1,11 +0,0 @@ -owner->dataRecord->getComments(); - } -} \ No newline at end of file diff --git a/tests/CommentingControllerTests.php b/tests/CommentingControllerTests.php index b3a187c..8107bcc 100644 --- a/tests/CommentingControllerTests.php +++ b/tests/CommentingControllerTests.php @@ -26,14 +26,14 @@ class CommentingControllerTests extends FunctionalTest { $this->assertEquals(10, substr_count($response->getBody(), ""), "10 approved, non spam comments on page 1"); $response = $this->get('CommentingController/rss?start=10'); - $this->assertEquals(3, substr_count($response->getBody(), ""), "3 approved, non spam comments on page 2"); + $this->assertEquals(4, substr_count($response->getBody(), ""), "3 approved, non spam comments on page 2"); // all comments on a type $response = $this->get('CommentingController/rss/CommentableItem'); $this->assertEquals(10, substr_count($response->getBody(), "")); $response = $this->get('CommentingController/rss/CommentableItem?start=10'); - $this->assertEquals(3, substr_count($response->getBody(), ""), "3 approved, non spam comments on page 2"); + $this->assertEquals(4, substr_count($response->getBody(), ""), "3 approved, non spam comments on page 2"); // specific page $response = $this->get('CommentingController/rss/CommentableItem/'.$item->ID);