Problem/Motivation
On the comment reply page, \Drupal\history\Controller\HistoryController::getNodeReadTimestamps throws a 404 error for the /history/get_node_read_timestamps path. It looks like the data-history-node-id attribute isn't present on the comment reply page, while the comment/drupal.comment-new-indicator JS library, which relies on that attribute to pass the node ids to \Drupal\history\Controller\HistoryController, is loaded on the comment reply page (in \Drupal\comment\CommentViewBuilder::buildComponents).
Steps to reproduce
- Install Standard profile
- Create an article
- Create an comment on the article
- Click 'Reply' on the created comment
Check the db log for the 404 error.
(tested on a clean install on Simplytest.me)
Proposed resolution
Don't load the comment/drupal.comment-new-indicator JS library on the comment reply page, since I don't think we need a 'new' indicator there?
| Comment | File | Size | Author |
|---|---|---|---|
| #26 | interdiff_17-26.txt | 652 bytes | nikhil_110 |
| #26 | 3154916-26.patch | 3.66 KB | nikhil_110 |
| #25 | 3154916-nr-bot.txt | 1.26 KB | needs-review-queue-bot |
| #22 | log-after.png | 33.61 KB | akhildev.cs |
| #22 | comment aftrpatch.png | 43.53 KB | akhildev.cs |
Comments
Comment #2
brunodboComment #3
cestmoi commentedNoticed same issue on latest stable drupal 9.01
Comment #4
pankaj.singh commentedI'm also able to reproduce the same on 9.0.x-dev and even on 9.1.
Comment #5
brunodboComment #6
brunodboAttached patch prevents the
comment/drupal.comment-new-indicatorfrom being loaded on the comment reply page. It prevents the 404 error from occurring, but might not be the best/cleanest way to resolve this.Comment #7
pankaj.singh commentedComment #8
pankaj.singh commented@brunodbo, thanks for the patch. I've tested the patch, it's working fine on my end.
Before patch SS are attached in #4. I'm attaching after patch SS here.
Comment #9
brunodboComment #10
brunodbo@pankaj.singh Thanks for testing.
Attached is a new patch that I believe is a bit better, since it doesn't hard code the route name, but checks whether the
noderoute requirement is present. Not sure though whether that is the best way to check that we are on routes wherecomment_node_view_alter()(hook_ENTITY_TYPE_view_alter()) is being called, since that is where thedata-history-node-idattribute is being added.Comment #11
samiullah commented@brunodbo I tested the latest patch on clean install of 9.1.x version
Before applying the patch I saw 404 errors in dblog
After applying the patch my local site stopped working , I was getting 500 error
Did git stash and site started working back
Comment #12
samiullah commentedComment #13
brunodbo@samiullah Something else slipped into the last patch, this should be a better one.
Comment #14
pankaj.singh commentedTested the patch on my local on 9.1, it's working as expected.
Attaching the SS for before and after Patch. RTBC+1
Comment #16
loze commentedI'm also seeing this error in 8.8.x views pages showing a list of comment entities.
Comment #17
NitinLama commentedhere's the patch for 9.2.x
Comment #18
NitinLama commentedComment #21
vikashsoni commentedPatch not applying in drupal-9.3.x-dev Needs to re-roll
Comment #22
akhildev.cs commentedHi,
I applied patch #17 patch applied cleanly, and working fine for me.
version: drupal-9.4.x-dev.
Comment #25
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #26
nikhil_110 commentedRe-roll Patch #17 && Attached patch against Drupal 10.1.x
Comment #29
liam morlandThis appears to have been obsoleted by #3542540: Deprecate comment libraries and move to history module.