Commit b88f2b14 authored by Aaron Wells's avatar Aaron Wells
Browse files

Fixes to blocktype:blog's listings in view_artefacts table

Bug 1401210. The get_artefacts() method is used by the Blogpost
artefact to find all the blocks that use a particular blogpost,
for storing in the view_artefacts table.

This one was skipping the blogposts themselves, and it was
including content from unpublished blog entries.

Change-Id: I4248be998ba4082722648a1ddbcf1c9334672409
parent 66cff695
......@@ -176,7 +176,10 @@ class PluginBlocktypeBlog extends PluginBlocktype {
$blog = $instance->get_artefact_instance($configdata['artefactid']);
if ($blogposts = $blog->get_children_instances()) {
foreach ($blogposts as $blogpost) {
$artefacts = array_merge($artefacts, $blogpost->get_referenced_artefacts_from_postbody());
if ($blogpost->get('published')) {
$artefacts[] = $blogpost->get('id');
$artefacts = array_merge($artefacts, $blogpost->get_referenced_artefacts_from_postbody());
$artefacts = array_unique($artefacts);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment