Skip to content

Commit 601247f

Browse files
committed
Also tag the comments
1 parent 996694e commit 601247f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

comments-bundle/src/Resources/contao/classes/Comments.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function addCommentsToTemplate(FrontendTemplate $objTemplate, \stdClass $
4242

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

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

105106
while ($objComments->next())
@@ -132,8 +133,17 @@ public function addCommentsToTemplate(FrontendTemplate $objTemplate, \stdClass $
132133
}
133134

134135
$arrComments[] = $objPartial->parse();
136+
$tags[] = 'contao.db.tl_comments.' . $objComments->id;
137+
135138
++$count;
136139
}
140+
141+
// Tag the comments (see #2137)
142+
if (System::getContainer()->has('fos_http_cache.http.symfony_response_tagger'))
143+
{
144+
$responseTagger = System::getContainer()->get('fos_http_cache.http.symfony_response_tagger');
145+
$responseTagger->addTags($tags);
146+
}
137147
}
138148

139149
$objTemplate->comments = $arrComments;

0 commit comments

Comments
 (0)