Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The comment date argument handlers for created all query the comment changed field. There are no argument handlers for the comment created field at all.
This is a problem in Drupal 8.2.x, 8.1.x, 8.0.x and Views 7.x.
Comment | File | Size | Author |
---|---|---|---|
#13 | 2689655-comment-date-arguments-13.patch | 4.63 KB | cafuego |
#2 | 2689655-comment-date-arguments-2.patch | 4.18 KB | cafuego |
Comments
Comment #2
cafuego CreditAttribution: cafuego at Creative Contingencies commentedAttached patch re-labels the existing handlers to match their database field and adds additional handlers for the created field.
I suspect that's the best way to fix it, as changing the field on the mislabeled handlers would change the data that existing views return, which we probably want to avoid.
Comment #3
cafuego CreditAttribution: cafuego at Creative Contingencies commentedComment #4
kattekrab CreditAttribution: kattekrab as a volunteer commentedComment #5
rteijeiro CreditAttribution: rteijeiro at Tieto commentedShould we use the shortened syntax for arrays?
Comment #6
cafuego CreditAttribution: cafuego at Creative Contingencies commented@rteijeiro Not in this patch, no. If you want to do that, do it in a separate issue and do the whole file.
Comment #7
jibranFix is fine but it needs tests.
Comment #8
jibranWell, these plugin are supplied by views and
NodeViewsData
is already using these so I think this fix is ok as is. And, we already have test coverage for\Drupal\views\Plugin\views\argument\Date*
plugin inArgumentDateTest
.But, I think VDC team should sign off this.
Comment #9
dawehnerWorks for me!
Comment #10
alexpottIs there any test coverage for the new fields? I guess not.
Comment #11
cafuego CreditAttribution: cafuego at Creative Contingencies commentedBtw, the patch doesn't need any work to backport it to D7, there's already a working patch on issue #2689657: D7 Comment date views arguments uses incorrect database column.
Comment #12
jibranWe don't need tests here plugins are already tested with entity_test data. There are no tests for nodes. I don't see a point of adding those for comments. Leaving it NW because I think we need an update hook in comment module to clear the views comment data.
Comment #13
cafuego CreditAttribution: cafuego at Creative Contingencies commentedAdded an empty update hook as per request from @jibran.
Comment #14
jibranThanks looks good now.
Comment #17
catchCommitted/pushed to 8.2.x and cherry-picked to 8.1.x. Thanks!
Agreed with jibran that I don't see explicit test coverage for this being useful - we'd only be testing the comment_views_data() hook implementation.
Let's open a new issue for Views 7.x-3.x for the backport so the core issue queue history gets retained.
Comment #18
kattekrab CreditAttribution: kattekrab as a volunteer commentedViews 7.x-3.x issue already exists here:
#2689657: D7 Comment date views arguments uses incorrect database column
And what about for 8.0.x ?
Comment #19
dqdJFYI #1374090: Editing a comment still changes creation date too make sure that there are no overlapping side effects...