Skip to content
Snippets Groups Projects
Commit e61d892f authored by catch's avatar catch
Browse files

Issue #1844146 by Berdir: Fixed comment_load() call in...

Issue #1844146 by Berdir: Fixed comment_load() call in template_preprocess_comment() re-loads comment parent entities because of disabled static cache.
parent e87beb03
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -1354,8 +1354,7 @@ function comment_delete_multiple($cids) { ...@@ -1354,8 +1354,7 @@ function comment_delete_multiple($cids) {
* @param array $cids * @param array $cids
* (optional) An array of entity IDs. If omitted, all entities are loaded. * (optional) An array of entity IDs. If omitted, all entities are loaded.
* @param bool $reset * @param bool $reset
* Whether to reset the internal static entity cache. Note that the static * (optional) Whether to reset the internal static entity cache.
* cache is disabled by default.
* *
* @return array * @return array
* An array of comment objects, indexed by comment ID. * An array of comment objects, indexed by comment ID.
...@@ -1373,14 +1372,13 @@ function comment_load_multiple(array $cids = NULL, $reset = FALSE) { ...@@ -1373,14 +1372,13 @@ function comment_load_multiple(array $cids = NULL, $reset = FALSE) {
* @param int $cid * @param int $cid
* The ID of the comment to be loaded. * The ID of the comment to be loaded.
* @param bool $reset * @param bool $reset
* Whether to reset the internal static entity cache. Note that the static * (optional) Whether to reset the internal static entity cache.
* cache is disabled by default.
* *
* @return * @return
* The comment object. * The comment object.
*/ */
function comment_load($cid, $reset = FALSE) { function comment_load($cid, $reset = FALSE) {
return entity_load('comment', $cid); return entity_load('comment', $cid, $reset);
} }
/** /**
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
* uri_callback = "comment_uri", * uri_callback = "comment_uri",
* fieldable = TRUE, * fieldable = TRUE,
* translatable = TRUE, * translatable = TRUE,
* static_cache = FALSE,
* route_base_path = "admin/structure/types/manage/{bundle}/comment", * route_base_path = "admin/structure/types/manage/{bundle}/comment",
* bundle_prefix = "comment_node_", * bundle_prefix = "comment_node_",
* entity_keys = { * entity_keys = {
......
...@@ -146,7 +146,7 @@ function postComment($node, $comment, $subject = '', $contact = NULL) { ...@@ -146,7 +146,7 @@ function postComment($node, $comment, $subject = '', $contact = NULL) {
} }
if (isset($match[1])) { if (isset($match[1])) {
$entity = comment_load($match[1]); $entity = comment_load($match[1], TRUE);
return $entity; return $entity;
} }
} }
......
...@@ -327,7 +327,7 @@ function testUserDelete() { ...@@ -327,7 +327,7 @@ function testUserDelete() {
$this->assertFalse(node_load($node->nid, TRUE), 'Node of the user has been deleted.'); $this->assertFalse(node_load($node->nid, TRUE), 'Node of the user has been deleted.');
$this->assertFalse(node_revision_load($revision), 'Node revision of the user has been deleted.'); $this->assertFalse(node_revision_load($revision), 'Node revision of the user has been deleted.');
$this->assertTrue(node_load($revision_node->nid, TRUE), "Current revision of the user's node was not deleted."); $this->assertTrue(node_load($revision_node->nid, TRUE), "Current revision of the user's node was not deleted.");
$this->assertFalse(comment_load($comment->id()), 'Comment of the user has been deleted.'); $this->assertFalse(comment_load($comment->id(), TRUE), 'Comment of the user has been deleted.');
// Confirm that the confirmation message made it through to the end user. // Confirm that the confirmation message made it through to the end user.
$this->assertRaw(t('%name has been deleted.', array('%name' => $account->name)), "Confirmation message displayed to user."); $this->assertRaw(t('%name has been deleted.', array('%name' => $account->name)), "Confirmation message displayed to user.");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment