Problem/Motivation
On #2393339: [META] Make sure Views base fields are using Field API for formatting, and do not lose functionality, we are updating all base entity fields in entity views data so that they are using Field API for formatting rather than using generic Views handlers.
This issue is about various fields in CommentViewsData that are currently using custom handlers from the Comment module:
- 'comment' handler for comment_field_data.subject and comment_field_data.cid
- 'comment_username' handler for comment_field_data.name ==> This is now a separate issue #2454163: Replace comment_username handler with generic views handler
- 'comment_depth' used for comment_field_data.thread
Proposed resolution
Change all of these to use the Field API formatter 'field' instead of the custom formatter. Should also be able to remove the custom formatters from the code base completely. That last one may need to have a custom handler, but if so it needs to derive from the Field API formatter so that it does the right thing with respect to entity access and translation.
Remaining tasks
Make a patch.
User interface changes
None.
API changes
Not really.
Comment | File | Size | Author |
---|---|---|---|
#37 | 2456705-37.patch | 20.89 KB | dawehner |
#33 | interdiff.txt | 1.48 KB | dawehner |
#33 | 2456705-33.patch | 20.9 KB | dawehner |
#30 | 2456705-29.patch | 19.42 KB | alexpott |
#29 | interdiff.txt | 1.32 KB | dawehner |
Comments
Comment #1
adamwhite CreditAttribution: adamwhite commentedHere's the first pass at this. It doesn't handle the changes related to comment_depth as of yet. If comment_depth is switched to 'field' instead of the custom formatter the output in views indeed doesn't look right as suggested in the proposed resolution. Next step providing this patch passes would be to switch the Depth class to derive from the Field API formatter.
Comment #2
adamwhite CreditAttribution: adamwhite commentedThat patch will fail testing as per issue #2090115 which moved the physical location of the install yml files from where they were when I rolled the patch. I'll re-roll and re-submit.
Comment #3
adamwhite CreditAttribution: adamwhite at JMR Logics commentedSame patch as before reflecting the move of those yml files to the optional subdirectory in issue #2090115.
Comment #6
andypostThere's a separate issue for "name" #2455131: Field comment_field_data.field_name should be using Field API formatter
Comment #7
jhodgdonClarification on #6 -- that separate issue is for the "field_name" field, not "name".
Comment #8
xjmComment #9
dawehnerSome work on it.
Comment #11
dawehnerLet's fix stuff.
Comment #13
dawehnerAlright.
Comment #14
effulgentsia CreditAttribution: effulgentsia commentedPer #2393339-57: [META] Make sure Views base fields are using Field API for formatting, and do not lose functionality, tagging for critical office hours, but if there's a reason to not have this particular child issue in that list, please untag it.
Comment #15
effulgentsia CreditAttribution: effulgentsia commentedThe issue summary says the scope of this issue includes
comment_username
andcomment_depth
, but those conversions aren't in the patch yet. Meanwhile, #2454163: Replace comment_username handler with generic views handler is open as a separate issue without a patch and not yet prioritized as critical. Should we close that as a duplicate or does it make sense for that to be split out?Comment #16
dawehnerI think it makes sense to have it split up, given that this issue doesn't need yet a new handler yet.
I adapted the comment_depth one, given that I see no usecase in exposing that as a formatter to be honest.
Comment #17
jhodgdonEditing summary for scope, and linking to related issue.
Comment #18
dawehnerWe should be able to remove the handlers now.
Comment #19
larowlanPretty close here, only nits and one question about a deletion
Less code++
nitpick two spaces after the =
note to self: this should be a method on CommentInterface cause we do it a few times in Comment class too.
Removing this file seems unrelated - if we remove it, we need a formatter to replace it? Or is this totally unused because the 'comment' column on {node} is loooong dead?
Love that we had tests that validated insecure access to comments.
%s/Render/Rendering?
nitpick >80
Comment #20
YesCT CreditAttribution: YesCT commentedfixed the nits. question from 19.3 still unanswered.
Comment #22
dawehnerYeah, that handler is not used at all anymore in views.
Thank you @yesct for fixing the review points!
Comment #23
dawehnerLet's fix the failures.
Comment #24
larowlanTried to manually test on simplytest.me, didn't apply - re-roll
Comment #25
larowlanShots from manual testing, comments on left, view on right
Comment #26
andypostBut there's still the same named filter plugin. But it has nothing about node
Comment #27
dawehnerWell, we just care about field handlers here.
Comment #28
alexpottLooks like we need to update CommentViewsFieldAccessTest.
Comment #29
dawehnerSure.
Comment #30
alexpottTestbot please test.
Comment #33
dawehnerFixed those test failures.
Comment #34
webchick@alexpott, @effulgentsia, @xjm and I discussed this on a D8 critical triage call today. Since comments are a content entity, like nodes and taxonomy terms, I think the expectation of users would be that access control would be respected in any given display, and if this wasn't fixed prior to release would likely result in an SA. Therefore, tagging as a triaged critical.
Comment #35
larowlanReady to go
Comment #37
dawehnerApplied again ... #2450153: Add a default_formatter to UUIDs fields conflicted with it.
Comment #38
alexpottThis issue addresses a critical bug and is allowed per https://www.drupal.org/core/beta-changes. Committed dc47451 and pushed to 8.0.x. Thanks!