Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
comment.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
30 Oct 2012 at 23:20 UTC
Updated:
29 Jul 2014 at 21:26 UTC
Jump to comment: Most recent file
Comments
Comment #1
dawehnerComment #2
berdirHm...
- This conflicts with #1778178: Convert comments to the new Entity Field API, you're not supposed to add arbitrary stuff to $comments anmore
- Note that it only helps when actually calling comment_view_multiple(), which views is currently not.
- I thin kthe comment render controller would be a better place for this.
That said, we don't actually *have* to attach it. It's enough if we would just call node_load_multiple() to prepare the entity cache, then it will be loaded from the cache anyway. That could even happen within the view class and without having to use comment_view_multiple()...
Comment #3
dawehnerI agree with you, the render controller should do that, as it also has the information which the nodes have.
It looked kind of ugly to actually load the nodes, and then node_load again later but doing it on the render controller helps.
We fixed that in http://drupalcode.org/project/drupal.git/blob/refs/heads/8.x:/core/modul...
and http://drupalcode.org/project/drupal.git/blob/refs/heads/8.x:/core/modul...
Comment #4
dawehnerSo here is a patch which does the loading on the comment render controller.
Comment #5
berdirMissing space :)
Comment #6
berdirComment #7
dawehnerWow, someone reviews patches! Thank you!
Comment #9
berdir#7: drupal-1827582-7.patch queued for re-testing.
Comment #10
berdirSorry, another one.
The array_unique() is not necessary, you already use the nid as key.
Not sure if we can do better with the comment here, but I don't know how, so I guess it's fine.
Comment #11
dawehnerUps, for a short moment I thought this would be a good idea to use array_unique, what about the new comment?
Comment #12
berdirHm. If $node doesn't exist, then this results in a php notice. We should move the if (!$node) up and do a if (!isset($nodes[$entity->nid]) instead.
Comment #13
berdirComment #14
dawehnerGood point!
Comment #15
berdirLooks good now :)
I would also argue that this is a (performance-improving) task, not a feature, it shouldn't be blocked because we're currently over thresholds.
Comment #16
webchickAgreed.
Committed and pushed to 8.x. Thanks!