Skip to content

Commit

Permalink
Merge branch '3.0' into 3
Browse files Browse the repository at this point in the history
  • Loading branch information
robbieaverill committed Oct 12, 2017
2 parents 5b4aa0a + 95d697f commit 8241d34
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
5 changes: 4 additions & 1 deletion code/extensions/SiteTreeContentReview.php
Expand Up @@ -454,7 +454,10 @@ public function canBeReviewedBy(Member $member = null)

$options = $this->getOptions();

if (!$options || !$options->hasExtension($this->class)) {
if (!$options
// Options can be a SiteConfig with different extension applied
|| (!$options->hasExtension($this->class) && !$options->hasExtension('ContentReviewDefaultSettings'))
) {
return false;
}

Expand Down
21 changes: 21 additions & 0 deletions tests/SiteTreeContentReviewTest.php
Expand Up @@ -313,4 +313,25 @@ public function testReviewActionNotVisibleForEditor()

SS_Datetime::clear_mock_now();
}

public function testSiteConfigSettingsAreUsedAsDefaults()
{
SS_Datetime::set_mock_now("2020-03-01 12:00:00");

/** @var Member $author */
$author = $this->objFromFixture('Member', 'editor');

/** @var SiteConfig $siteConfig */
$siteConfig = SiteConfig::current_site_config();

// Set the author to a default user for reviewing
$siteConfig->OwnerUsers()->add($author);

$emptyPage = new Page;
$emptyPage->NextReviewDate = '2020-02-20 12:00:00';

$this->assertTrue($emptyPage->canBeReviewedBy($author));

SS_Datetime::clear_mock_now();
}
}

0 comments on commit 8241d34

Please sign in to comment.