Last read comment field/filter/argument uses still the node.changed instead of node_field_data.changed column

Created on 10 September 2013, almost 12 years ago
Updated 18 April 2023, over 2 years ago

Updated: Comment 0

Problem/Motivation

Comment entity statistics view plugins are broken and there's no tests.
They are not properly ported to interact with entities other then nodes.
There's no way to detect the name of the "changed" field for entities that implements EntityChangedInterface

Proposed resolution

Probably needs to check that commented entity type implements \Drupal\Core\Entity\EntityChangedInterface and expose this field only for this entity types

Remaining tasks

Fix views integration with comment statistics and cover with tests.

User interface changes

API changes

Related Issues

🐛 Bug report
Status

Needs work

Version

9.5

Component
Comment 

Last updated 3 days ago

Created by

🇩🇪Germany dawehner

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇺🇸United States dillix

    @ravi.shankar

    I reviewed you patch all works fine, but you need to fix translated text in views:

                previous: ‹‹
                next: ››
  • 🇬🇧United Kingdom jonathanshaw Stroud, UK

    Otherwise RTBC I think

  • 🇩🇪Germany sachbearbeiter

    @darvanen @ravi.shankar Thanks a lot!

  • 🇺🇸United States capysara

    Removed translated text per comment in #108

  • Status changed to Needs review about 2 years ago
  • Open in Jenkins → Open on Drupal.org →
    Environment: PHP 8.1 & MySQL 5.7
    last update about 2 years ago
    30,343 pass
  • Status changed to Needs work about 2 years ago
  • 🇺🇸United States smustgrave

    This will have to be committed to 11.x first.

  • 🇩🇪Germany sachbearbeiter

    dawehner already has a long beard ... 10 years ...

  • last update about 2 years ago
    Patch Failed to Apply
  • Open in Jenkins → Open on Drupal.org →
    Environment: PHP 8.1 & MySQL 5.7
    last update about 2 years ago
    Patch Failed to Apply
  • Status changed to Needs review about 2 years ago
  • last update about 2 years ago
    29,802 pass, 2 fail
  • 🇮🇳India mrinalini9 New Delhi

    Rerolled patch #111 for 11.x branch, please review it.

    Thanks!

  • Status changed to Needs work over 1 year ago
  • 🇩🇪Germany sachbearbeiter

    Can we pay someone to finally commit the thing?

  • 🇬🇧United Kingdom jonathanshaw Stroud, UK

    You could RTBC it ...

  • Assigned to capysara
  • 🇺🇸United States capysara

    capysara changed the visibility of the branch 11.x to hidden.

  • 🇺🇸United States capysara

    capysara changed the visibility of the branch 2086125-last-read-comment to hidden.

  • Pipeline finished with Skipped
    over 1 year ago
    #66561
  • Pipeline finished with Skipped
    over 1 year ago
    #66562
  • Pipeline finished with Canceled
    over 1 year ago
    Total: 32s
    #66560
  • Pipeline finished with Success
    over 1 year ago
    Total: 650s
    #66563
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇺🇸United States capysara

    I moved this into a MR instead of a patch. I'm attaching an interdiff, but I only changed the $field_alias property to allow it to be nullable to address the failed test.

  • Pipeline finished with Success
    over 1 year ago
    Total: 527s
    #66572
  • 🇬🇧United Kingdom jonathanshaw Stroud, UK

    #115 introduced a schema.orig file I'm not familiar with. Is that correct? Otherwise I'd RTBC it.

  • 🇺🇸United States capysara

    Ooops. That was unintentional. Thanks for catching!

    I updated the MR to remove it.

  • Pipeline finished with Success
    over 1 year ago
    Total: 639s
    #66870
  • Status changed to Needs work over 1 year ago
  • 🇺🇸United States smustgrave

    Few nitpicky stuff.

  • 🇺🇸United States capysara

    Updated per MR comments. Thanks Stephen!

  • Status changed to Needs review over 1 year ago
  • Pipeline finished with Success
    over 1 year ago
    Total: 4042s
    #67015
  • Status changed to RTBC over 1 year ago
  • 🇺🇸United States smustgrave

    Hiding all patches for clarity.

    Ran the test-only feature

    1) Drupal\Tests\comment\Functional\Views\CommentStatisticsTest::testEntityMulChanged
    Drupal\Core\Config\Schema\SchemaIncompleteException: Schema errors for views.view.test_ces_entity_test_mul_changed with the following errors: views.view.test_ces_entity_test_mul_changed:display.default.display_options.fields.last_updated.date_format missing schema, views.view.test_ces_entity_test_mul_changed:display.default.display_options.fields.last_updated.custom_date_format missing schema, views.view.test_ces_entity_test_mul_changed:display.default.display_options.fields.last_updated.timezone missing schema, 0 [display.default.display_options.fields.last_updated.date_format] 'date_format' is not a supported key., 1 [display.default.display_options.fields.last_updated.custom_date_format] 'custom_date_format' is not a supported key., 2 [display.default.display_options.fields.last_updated.timezone] 'timezone' is not a supported key.
    /builds/issue/drupal-2086125/core/lib/Drupal/Core/Config/Development/ConfigSchemaChecker.php:98
    /builds/issue/drupal-2086125/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php:111
    /builds/issue/drupal-2086125/core/lib/Drupal/Core/Config/Config.php:230
    /builds/issue/drupal-2086125/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php:278
    /builds/issue/drupal-2086125/core/lib/Drupal/Core/Entity/EntityStorageBase.php:486
    /builds/issue/drupal-2086125/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php:257
    /builds/issue/drupal-2086125/core/lib/Drupal/Core/Entity/EntityBase.php:352
    /builds/issue/drupal-2086125/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php:609
    /builds/issue/drupal-2086125/core/modules/views/src/Tests/ViewTestData.php:49
    /builds/issue/drupal-2086125/core/modules/comment/tests/src/Functional/Views/CommentStatisticsTest.php:42
    /builds/issue/drupal-2086125/vendor/phpunit/phpunit/src/Framework/TestResult.php:728
    ERRORS!
    Tests: 1, Assertions: 2, Errors: 1.
    

    Applying locally on a standard install and doesn't appear to have issues.
    Created a test view with the Comment Statistics: Updated/commented date field added, no issues
    Created some test Articles adding comments as I went.
    Date seems correct to me.

  • 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

    Issue credits

  • Status changed to Needs work over 1 year ago
  • 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

    Left some comments on the MR

    Some regarding new coding standards, but also some about making sure the field-type is what we expect and some missing test coverage.

    I'm keeping a close eye on this one as I'm keen to see it resolved too.

  • Assigned to capysara
  • Pipeline finished with Success
    over 1 year ago
    Total: 617s
    #68800
  • Pipeline finished with Success
    over 1 year ago
    Total: 606s
    #69191
  • Pipeline finished with Success
    over 1 year ago
    Total: 487s
    #69237
  • Pipeline finished with Success
    over 1 year ago
    Total: 646s
    #69256
  • Pipeline finished with Success
    over 1 year ago
    Total: 632s
    #69264
  • 🇬🇧United Kingdom jonathanshaw Stroud, UK

    For anyone following, this is still NW for the test coverage.

  • 🇺🇸United States capysara

    I'm still working on the test, but that will take me a bit longer. If someone else can create the test quicker, feel free to grab it. Or if anyone has thoughts or pointers, you can also ping me in Slack.

  • 🇬🇷Greece dwb17

    dwb17 changed the visibility of the branch 2086125-last-read-comment-11x to hidden.

  • Issue was unassigned.
  • First commit to issue fork.
  • Pipeline finished with Failed
    about 1 year ago
    Total: 191s
    #207337
  • 🇺🇸United States loze Los Angeles

    loze changed the visibility of the branch 2086125-last-read-comment-11x to active.

  • 🇺🇸United States beunerd Providence, Rhode Island

    beunerd changed the visibility of the branch 2086125-last-read-comment to active.

  • Merge request !8561Resolve #2086125 "Last read comment" → (Closed) created by beunerd
  • 🇺🇸United States Kasey_MK

    I'm having trouble parsing the status of this issue and getting a working patch out of it. Unknown column 'node.changed' on filter by 'Updated/commented date' 🐛 Unknown column 'node.changed' on filter by "Updated/commented date" Closed: duplicate has been closed as a duplicate in favor of this issue, but it did have a patch that ( with a little tweak as I commented 🐛 Unknown column 'node.changed' on filter by "Updated/commented date" Closed: duplicate ) seems to get my 10.3.7 site back to working without errors. Sharing here in case it helps others.

  • 🇪🇸Spain pandepoulus

    Hello, not sure if i should comment here or create a new issue. None of the patches work for me, (i'm using the sort StatisticsLastUpdated handler).
    blame is on the field_alias parameter, which is non nullable, and $this->query->addOrderBy(.....) is being called.
    That function does return null, so the non nullable parameter raises an exception.

    For me the solution was as easy as just call the orderBy without assigning it to a field_alias parameter, which i think is unnecesary in a sort filter.

  • First commit to issue fork.
  • Pipeline finished with Failed
    about 1 month ago
    Total: 149s
    #537363
  • 🇬🇧United Kingdom alexpott 🇪🇺🌍

    @pandepoulus yep assigning the return $this->query->orderBy() to a property is pointless. I've updated the MR to fix this for 11.x.

    We still need to add test coverage for the comments on entity types that do not implement EntityChangedInterface

  • Pipeline finished with Failed
    about 1 month ago
    Total: 822s
    #537366
  • Pipeline finished with Running
    about 1 month ago
    #537441
  • 🇬🇧United Kingdom alexpott 🇪🇺🌍

    So I think we only need the StatisticsLastUpdated field, filter and sort to entity types which implement EntityChangedInterface and have a changed field. That way we avoid quite a few issues. If you want to filter on the last_updated time in comment_entity_statistics then you can use the last comment timestamp field, filter and sort... you do not need this special implementation.

  • 🇨🇦Canada joelpittet Vancouver

    This is looking good. Due to the changes not applying in D10, it’s trickier for me to test manually right now.

    I’ve postponed 🐛 Views ‘last updated/commented’ field fails to sort entities without comment statistics Active on this, it’s related but not the same issue, just commenting for awareness. It's related to the stats not being populated in D8+

Production build 0.71.5 2024