"Recent content", the page coming from tracker module doesn't work properly.
The "new comments" link is not displayed.
Steps to reproduce:
1. Install brand new site.
2. Log in with the admin user.
3. Enable tracker module.
4. Create another user, and make it admin (just for permissions sake).
5. Open incognito or a different browser and log in with the second user).
6. Create an article and forum post with the second user.
7. Comment on the article and forum post with the second user.
8. Go to /activity on the first user.
You should see "1 new" on the comments tab, but it doesn't show.
The request to: http://drupal86.dev.localhost/comments/render_new_comments_node_links
Returns:
TypeError: Argument 1 passed to Drupal\comment\CommentManager::getCountNewComments() must implement interface Drupal\Core\Entity\EntityInterface, null given, called in /Users/ariel/Sites/drupal/drupal86.git/core/modules/comment/src/Controller/CommentController.php on line 333 in Drupal\comment\CommentManager->getCountNewComments() (line 180 of /Users/ariel/Sites/drupal/drupal86.git/core/modules/comment/src/CommentManager.php).
This is actually because the POST node_ids[] are null, and the reason for that is #2915993: Adjust render_new_comments_node_links to fix issues, which is the traversing of the table column HTML tags could fail on some browsers/OSs/themes. However, even by fixing that, you also get:
Error: Call to a member function getSetting() on null in Drupal\comment\CommentStorage->getNewCommentPageNumber() (line 135 of /Users/ariel/Sites/drupal/drupal86.git/core/modules/comment/src/CommentStorage.php).
And the reason for that is also both mentioned on the comments here and on #2915993: Adjust render_new_comments_node_links to fix issues and is because you are not sending anywhere the comment field name and that's needed for this to work.
No interdiff really as it's a whole different approach.
jurgenhaas that did #2915993: Adjust render_new_comments_node_links to fix issues deserves credit too if this one moves forward.
Comment | File | Size | Author |
---|---|---|---|
#48 | interdiff_2620748_42-48.txt | 1.71 KB | nevergone |
#48 | 2620748-48.patch | 5.66 KB | nevergone |
#42 | 2620748-42.patch | 5.42 KB | nevergone |
#31 | 2620748-31.patch | 5.52 KB | hanoii |
Comments
Comment #2
larowlanWhat do you mean by Recent Content?
Comment #3
Jeff Burnz CreditAttribution: Jeff Burnz commentedThe URL is in the error message: http://d8head:8888/activity/1 this is page titled "Recent Content" that displays a table with recently added content, you need the Activity Tracker module enabled and the link is in the Tools menu.
Comment #4
dawehnerBugfixes should be fixed against 8.0.x, IMHO
Comment #5
larowlandigging in
Comment #6
larowlanNot sure we can test this without JavaScript testing.
This bring tracker-history.js into line with node-new-comment-links.js
Comment #7
larowlanThe bug is in tracker module code
Comment #8
andypostAlso history module related
Comment #9
catchI think the history callback should validate the arguments it gets too. Can't find it right now but there's a similar issue open for the nid being out of range.
You could manually trigger the PHP error here which isn't great (especially if load balancers take 5* errors as a sign to take nodes out of rotation).
Comment #10
andypostComment #11
andypostI can't reproduce that on
/activity/1
anymoremaybe something was fixed already? or that was some caching issue
Anyway something like the patch is needed with test coverage
Comment #12
BerdirNeeds work for test coverage then.
Also if you convert this to do a loadMultiple($nids) as $node then you've solved the problem too. A node that can't be loaded will never go into the loop. And performance is better.
Comment #13
andypost@Berdir I wanna to convert that to load multiple long ago, but each time that out of scope ;)
There's actually 3 problems here:
1) JS passed only node Ids - manager call will be broken (no idea how reproduce) so @larowlan patch makes sense but that's a front side
2) Nodes could have different comment fields (names of fields) so
$node->{wrong_field_name}
will throw this exception too3) no check for access/existence of nodes (my patch) should be refactored to load multiple call.
request should carry field name for each node or group them
Comment #14
SerShevchykI think we need replace 'comment' with name of last comment field, but we have empty value last_comment_name in $node in tracker.pages.inc
Comment #15
andypostComment #17
andypostthe field name could be different for each node and not only one
Comment #18
andypostThe proper controller code, JS side should be fixed like #14
pass a field_name is a requirement
yep! but needs to check a views plugins as well, to properly fix all over
Comment #20
andypostComment #22
xjmThe comments on this issue confuse me because they almost seem to be about different bugs; can we update the issue summary with steps to reproduce this issue?
Comment #28
hanoiiA similar issue with a similar patch is on #2915993: Adjust render_new_comments_node_links to fix issues. That covers another thing too which is related to the traversing of the siblings not coping very nicely with other themes. I think I'll try to make the other issue more into the traversing and leave this one for the missing
field_name
which is indeed a bug.Comment #29
hanoiiAfter further looking at this, the real reason behind this is actually what was first described on #2915993: Adjust render_new_comments_node_links to fix issues, at first I was going to keep both separated, but they are the same thing. I am gonna mark the other one duplicate and improve this one.
Comment #30
hanoiiComment #31
hanoiiThis will likely go to needs work quick enough, but at least to prompt for some reviews.
This fixes this issue as well as #2915993: Adjust render_new_comments_node_links to fix issues.
It's simple in a way. The one thing that it's not really looking for is for the odd case of a node having more than one comment field. The tracker pages take that into consideration to displaying the total comments, but gets a lot trickier fi we want to support that and the "new comment link". It's likely a bug larger and broader issue.
I'd say we try to get this in in the best shape possible and work on the wider issue further along the way, as this will at least make most installs actually work. I am surprised this hasn't come up more often. I guess the tracker module is not widely used?
Comment #32
hanoiiPatch is for 8.6.x
Comment #33
hanoiijurgenhaas that did #2915993: Adjust render_new_comments_node_links to fix issues deserves credit too if this one moves forward.
Comment #34
hanoiiThis one is for D85, I need it on a project. The 8.6 doesn't apply because some code was moved from the bottom of the file to the top (or viceversa)
Comment #35
hanoiiSo, both patches applies to both branches. It's odd. I can't apply #31 to 8.5.x with
patch -p1
but I do withgit apply
and I guess that's what jenkins is doing. composer-patches doesn't work though so I'll leave #34 for reference for the time being.Comment #36
hanoiiComment #37
jurgenhaasThanks @hanoii for coordinating this with the what's now a duplicate issue #2915993: Adjust render_new_comments_node_links to fix issues. I will give this patch a try and report back on the success.
Comment #38
hanoiiComment #39
jurgenhaas@hanoii I've tested the patch from #34 with Drupal 8.5.2 and can confirm that it is working just fine. Giving it a RTBC.
Comment #40
andypostIt still needs tests
Comment #42
nevergone CreditAttribution: nevergone commentedpatch #31 re-rolled for 8.6.x (da56eaa0ab40)
Comment #44
nevergone CreditAttribution: nevergone commentedComment #45
andypostfor tests
Comment #46
nevergone CreditAttribution: nevergone commented@andypost
(Sorry, my english is bad.)
So, Drupal 8 use two comment types by default: "Default comments" (comment) and "Comment_forum" (comment_forum), and use two comment field with the same name.
Article content type use "comment" comment type and forum topic content type use "comment_forum" comment type.
Therefore, if there are articles and forum posts in the tracker activity page, none of the solutions work.
See "Steps to reproduce" from the issue.
Comment #48
nevergone CreditAttribution: nevergone commentedDrupal 8.8.x rerolled patch.
Comment #54
quietone CreditAttribution: quietone at PreviousNext commentedThis extension is deprecated and scheduled for removal in Drupal 11.
This is now Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project and the Extensions approved for removal policies.
It will be moved to the contributed extension once the Drupal 11 branch is open.
Comment #56
andypost