Skip to content

Commit

Permalink
Merge branch '3'
Browse files Browse the repository at this point in the history
  • Loading branch information
robbieaverill committed Oct 12, 2017
2 parents 5877247 + 8241d34 commit a55d5c2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Extensions/SiteTreeContentReview.php
Expand Up @@ -488,7 +488,10 @@ public function canBeReviewedBy(Member $member = null)
return false;
}

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

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

DBDatetime::clear_mock_now();
}

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

/** @var Member $author */
$author = $this->objFromFixture(Member::class, '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));

DBDatetime::clear_mock_now();
}
}

0 comments on commit a55d5c2

Please sign in to comment.