Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295112

Remove comment_prepare_thread()

$
0
0

Problem/Motivation

Function brings additional overhead for comment render by looping each comment listing and initializing

It doesn't do anything by itself, it only sets 'divs/divs_final' properties in comment entities, which are only used in one place: CommentViewBuilder::alterBuild(). (Formerly comment_view($comment), see commit #e9ca778b)

The comment that is in the code now

// The $divs element instructs #prefix whether to add an indent div or
// close existing divs (a negative value).

...doesn't make any sense by itself, and clearly refers to the code that is now in alterBuild(). The whole function should be moved into CommentViewBuilder.

And since it doesn't make any sense by itself, in this case I don't think it even needs marking @deprecated. The function removal can be marked in https://www.drupal.org/node/2299799 (if we don't care about the version number mentioned in there being exactly right).

Proposed resolution

Remove the function by incorporating it into \Drupal\comment\CommentViewBuilder::buildComponents() where it actually used.
Comment entity should not be changed by build/render layer.

Remaining tasks

agree on approach, commit

User interface changes

no

API changes

Removes comment_prepare_thread() as no longer needed and buggy.

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue categoryBug because changes entity properties without need and degrades performance.
Issue priorityMajor because affects performance and d.o
Prioritized changesThe main goal of this issue is performance and removal of useless code.
DisruptionNot disruptive for core/contributed and custom modules/themes because it used only internally and the functionality incorporated into CommentViewBuilder

Viewing all articles
Browse latest Browse all 295112

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>