mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
Bugfix: Updating BlogPostFilter::augmentSQL to make use of modern Versioned methods.
This resolves an issue with some modules that rely upon get_draft_site_secured, like Elemental and sharedraftcontent
This commit is contained in:
parent
9d3a398901
commit
712812332d
@ -28,13 +28,17 @@ class BlogPostFilter extends DataExtension
|
||||
*/
|
||||
public function augmentSQL(SQLSelect $query, DataQuery $dataQuery = null)
|
||||
{
|
||||
$stage = Versioned::get_stage();
|
||||
|
||||
if (Controller::has_curr() && Controller::curr() instanceof LeftAndMain) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($stage == 'Live' || !Permission::check('VIEW_DRAFT_CONTENT')) {
|
||||
if (Versioned::get_stage() === Versioned::LIVE ||
|
||||
(
|
||||
Versioned::get_draft_site_secured() &&
|
||||
!Permission::check('VIEW_DRAFT_CONTENT')
|
||||
)
|
||||
) {
|
||||
$query->addWhere(sprintf(
|
||||
'"PublishDate" < \'%s\'',
|
||||
Convert::raw2sql(DBDatetime::now())
|
||||
|
Loading…
Reference in New Issue
Block a user