Skip to content

Commit

Permalink
Also tag the comments
Browse files Browse the repository at this point in the history
  • Loading branch information
leofeyer committed Dec 9, 2020
1 parent 996694e commit 601247f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion comments-bundle/src/Resources/contao/classes/Comments.php
Expand Up @@ -42,7 +42,7 @@ public function addCommentsToTemplate(FrontendTemplate $objTemplate, \stdClass $

$objTemplate->comments = array(); // see #4064

// Tag the comment (see #2137)
// Tag the source record (see #2137)
if (System::getContainer()->has('fos_http_cache.http.symfony_response_tagger'))
{
$responseTagger = System::getContainer()->get('fos_http_cache.http.symfony_response_tagger');
Expand Down Expand Up @@ -100,6 +100,7 @@ public function addCommentsToTemplate(FrontendTemplate $objTemplate, \stdClass $
if ($objComments !== null && ($total = $objComments->count()) > 0)
{
$count = 0;
$tags = array();
$objPartial = new FrontendTemplate($objConfig->template ?: 'com_default');

while ($objComments->next())
Expand Down Expand Up @@ -132,8 +133,17 @@ public function addCommentsToTemplate(FrontendTemplate $objTemplate, \stdClass $
}

$arrComments[] = $objPartial->parse();
$tags[] = 'contao.db.tl_comments.' . $objComments->id;

++$count;
}

// Tag the comments (see #2137)
if (System::getContainer()->has('fos_http_cache.http.symfony_response_tagger'))
{
$responseTagger = System::getContainer()->get('fos_http_cache.http.symfony_response_tagger');
$responseTagger->addTags($tags);
}
}

$objTemplate->comments = $arrComments;
Expand Down

0 comments on commit 601247f

Please sign in to comment.