Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove relation to comments (Fixes #76)

  • Loading branch information...
commit 5cfa476264658b75c7d28e3b86b003aa81149aac 1 parent 5a8de05
Will Rossiter wilr authored
4 _config.php
View
@@ -28,8 +28,4 @@
if(class_exists('SiteTree') && !Commenting::has_commenting('SiteTree')) {
Commenting::add('SiteTree');
-}
-
-if(class_exists('ContentController')) {
- ContentController::add_extension('ContentControllerCommentsExtension');
}
7 code/extensions/CommentsExtension.php
View
@@ -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') {
11 code/extensions/ContentControllerCommentsExtension.php
View
@@ -1,11 +0,0 @@
-<?php
-
-/**
- * @package comments
- */
-class ContentControllerCommentsExtension extends Extension {
-
- public function Comments() {
- return $this->owner->dataRecord->getComments();
- }
-}
4 tests/CommentingControllerTests.php
View
@@ -26,14 +26,14 @@ public function testRSS() {
$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);
Please sign in to comment.
Something went wrong with that request. Please try again.