Problem/Motivation
\Drupal\comment\CommentViewBuilder::buildComponents() within loop checking $this->moduleHandler->moduleExists('history') && $this->currentUser->isAuthenticated() for every comment and attach indication of unread comments.
But history module works only for node entities which is a bug when comments attached to other entities.
Also it creates placeholder for each comment to attach similar settings for JS which is needed only once (so could be optimized)
Proposed resolution
- Add condition to attach history libraries to node entities only
- Move common condition check out of loop
-
Remaining tasks
- create a patch
- review
- commit
User interface changes
no
API changes
no
Data model changes
no
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | interdiff_2_7.txt | 2.82 KB | zviryatko |
| #7 | 2955803-7-test-only.patch | 2.98 KB | zviryatko |
| #7 | 2955803-7.patch | 4.17 KB | zviryatko |
Comments
Comment #2
andypostKind of that fix should work
Comment #3
larowlanLooks good.
Should we add a test?
Comment #4
andypostLooks yep, this is a bug
Another question is performance - each comment creates it but placeholders are not cheap
Comment #5
zviryatko commentedComment #6
andypostThanx for tests, please create separate patch with suffix
-test-only.patchto be sure coverage worksminor, needs new line
Comment #7
zviryatko commentedComment #9
andypostIMO it's ready
Comment #12
catchFixed the following phpcs issues on commit:
Committed/pushed to 8.6.x and cherry-picked to 8.5.x. Thanks!
Comment #13
andypost