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

  1. Install Standard profile
  2. Create an article
  3. Create an comment on the article
  4. 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?

Comments

brunodbo created an issue. See original summary.

brunodbo’s picture

Issue summary: View changes
cestmoi’s picture

Noticed same issue on latest stable drupal 9.01

pankaj.singh’s picture

StatusFileSize
new44.92 KB
new62.84 KB
new47.74 KB
new60.71 KB

I'm also able to reproduce the same on 9.0.x-dev and even on 9.1.

brunodbo’s picture

Version: 9.0.x-dev » 9.1.x-dev
brunodbo’s picture

Status: Active » Needs review
StatusFileSize
new3.13 KB

Attached patch prevents the comment/drupal.comment-new-indicator from 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.

pankaj.singh’s picture

Assigned: Unassigned » pankaj.singh
pankaj.singh’s picture

Assigned: pankaj.singh » Unassigned
StatusFileSize
new30.04 KB
new27.89 KB
new46.4 KB
new42.32 KB

@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.

brunodbo’s picture

Title: /history/get_node_read_timestamps 404 error on comment reply page » History controller throws 404 error on comment reply page
brunodbo’s picture

StatusFileSize
new3.43 KB

@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 node route requirement is present. Not sure though whether that is the best way to check that we are on routes where comment_node_view_alter() (hook_ENTITY_TYPE_view_alter()) is being called, since that is where the data-history-node-id attribute is being added.

samiullah’s picture

@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

samiullah’s picture

Assigned: samiullah » Unassigned
brunodbo’s picture

StatusFileSize
new3.14 KB

@samiullah Something else slipped into the last patch, this should be a better one.

pankaj.singh’s picture

StatusFileSize
new29.49 KB
new48.5 KB
new33.42 KB
new28.47 KB

Tested the patch on my local on 9.1, it's working as expected.

Attaching the SS for before and after Patch. RTBC+1

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

loze’s picture

I'm also seeing this error in 8.8.x views pages showing a list of comment entities.

NitinLama’s picture

Assigned: Unassigned » NitinLama
StatusFileSize
new3.11 KB
new3.11 KB

here's the patch for 9.2.x

NitinLama’s picture

Assigned: NitinLama » Unassigned

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

vikashsoni’s picture

Patch not applying in drupal-9.3.x-dev Needs to re-roll

akhildev.cs’s picture

StatusFileSize
new27.65 KB
new59.82 KB
new43.53 KB
new33.61 KB

Hi,
I applied patch #17 patch applied cleanly, and working fine for me.
version: drupal-9.4.x-dev.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new1.26 KB

The 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.

nikhil_110’s picture

StatusFileSize
new3.66 KB
new652 bytes

Re-roll Patch #17 && Attached patch against Drupal 10.1.x

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

liam morland’s picture

Status: Needs work » Closed (outdated)
Related issues: +#3542540: Deprecate comment libraries and move to history module

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.