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, about 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 about 21 hours 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
  • last update about 2 years ago
    30,343 pass
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States capysara
  • 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
  • last update about 2 years ago
    Patch Failed to Apply
  • Status changed to Needs review almost 2 years ago
  • last update almost 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
  • ๐Ÿ‡บ๐Ÿ‡ธ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
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States capysara
  • 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
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States 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.
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States capysara
  • 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
    2 days 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
    2 days ago
    Total: 822s
    #537366
  • Pipeline finished with Running
    2 days 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.

Production build 0.71.5 2024