mirror of
https://github.com/silverstripe/silverstripe-contentreview
synced 2024-10-22 17:05:47 +02:00
FIX Ensure SiteConfig defaults are used as fallback options
This commit is contained in:
parent
c6da57f0c5
commit
11a5dc7617
@ -454,7 +454,10 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
|
||||
|
||||
$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;
|
||||
}
|
||||
|
||||
|
@ -313,4 +313,25 @@ class SiteTreeContentReviewTest extends ContentReviewBaseTest
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user