Remove relation to comments (Fixes #76)

This commit is contained in:
Will Rossiter 2013-12-19 19:56:46 +13:00
parent 5a8de05ea7
commit 5cfa476264
4 changed files with 3 additions and 23 deletions

View File

@ -28,8 +28,4 @@
if(class_exists('SiteTree') && !Commenting::has_commenting('SiteTree')) {
Commenting::add('SiteTree');
}
if(class_exists('ContentController')) {
ContentController::add_extension('ContentControllerCommentsExtension');
}

View File

@ -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') {

View File

@ -1,11 +0,0 @@
<?php
/**
* @package comments
*/
class ContentControllerCommentsExtension extends Extension {
public function Comments() {
return $this->owner->dataRecord->getComments();
}
}

View File

@ -26,14 +26,14 @@ class CommentingControllerTests extends FunctionalTest {
$this->assertEquals(10, substr_count($response->getBody(), "<item>"), "10 approved, non spam comments on page 1");
$response = $this->get('CommentingController/rss?start=10');
$this->assertEquals(3, substr_count($response->getBody(), "<item>"), "3 approved, non spam comments on page 2");
$this->assertEquals(4, substr_count($response->getBody(), "<item>"), "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(), "<item>"));
$response = $this->get('CommentingController/rss/CommentableItem?start=10');
$this->assertEquals(3, substr_count($response->getBody(), "<item>"), "3 approved, non spam comments on page 2");
$this->assertEquals(4, substr_count($response->getBody(), "<item>"), "3 approved, non spam comments on page 2");
// specific page
$response = $this->get('CommentingController/rss/CommentableItem/'.$item->ID);