Problem/Motivation
At admin/structure/comment/types/add we allow sitebuilders to create comment types, and offer "Target entity type" of any content entity type. However, comment fields cannot be added to content entity types that have string primary keys (see #2205215: {comment} and {comment_entity_statistics} only support integer entity ids and #2496699: Allow comments to be attached to entities using a string primary key).
Thus sitebuilders are allowed to create comment types that they cannot actually use, without warning or explanation.
Proposed solution
At #11 @larowlan proposed a patch which removed ineligible content entity types from those offered as "Target entity type" and displayed below there the names of ineligible entity types.
Tasks
- decide whether it is necessary to display the names of the ineligible entity types
- amend patch to remove this if it is deemed unecessary
- fix failing tests
API changes
None
Comment | File | Size | Author |
---|---|---|---|
#40 | interdiff-2496913-36-40.txt | 1.65 KB | mohit_aghera |
#40 | 2496913-40.patch | 3.42 KB | mohit_aghera |
#36 | 2496913-36.patch | 3.23 KB | jungle |
#36 | 2496913-36-test-only.patch | 1.35 KB | jungle |
Comments
Comment #1
bill richardson CreditAttribution: bill richardson as a volunteer commentedIs the problem that the option has been moved from the edit page to manage fields page ?
Comment #2
attiks CreditAttribution: attiks commentedThe problem is that I can create a comment type for my custom entity (using string as id) at
admin/structure/comment
, but when I go toadmin/structure/external-entity-types/manage/users/fields/add-field
I don't see the field.Off topic: the real fix is to solve #2496699: Allow comments to be attached to entities using a string primary key
Comment #3
dawehnerIs that really critical?
I think having an issue summary with more information would be helpful :)
Comment #4
attiks CreditAttribution: attiks commentedComment #5
dawehnerInteresting, this for sure sounds like a real bug we should fix :)
Comment #6
dawehnerTag work
Comment #7
andypostWe should disable creation of comment type for non-integer IDs for 8.0.x because of beta stage.
Also
comment_form_field_ui_field_storage_add_form_alter()
and new alter function should point to #2496699: Allow comments to be attached to entities using a string primary keyComment #8
andypostAlso it would be great to update
comment_help()
to dynamically generate a list of entity types that can't be commented atmComment #9
larowlanAgree - the fix here is to prevent listing those entity types in the target-entity type field of the comment-type form.
If any do exist, we should add a description indicating why those aren't listed.
Comment #10
andypostComment #11
larowlanAdded message and limited available entity-types.
Failing test.
Screenshot:
Comment #13
larowlanComment #14
Bojhan CreditAttribution: Bojhan commentedThis interface looks pretty afwul, can we have a update on the issue summary why we need this what usecase its meant to solve etc?
Comment #15
attiks CreditAttribution: attiks commentedComment #16
Bojhan CreditAttribution: Bojhan commentedWhy is this DX? This is UI? I am not sure why we ever made this decision on hiding?
I agree with #3 here, the issue summary is incomplete.
Comment #17
andypostThis is UX problem - we can't add comment fields to entity type that has non-integer ID (internal)
So we need to show some message to user why he's failed to add commenting
Comment #18
attiks CreditAttribution: attiks at Attiks commented#14 Sorry for the confusing title change, I somehow missed the screenshot of #11, but I have to agree that it looks confusing with the long list of entity types.
#17 Can you update the issue summary?
Comment #21
jonathanshawComment #25
larowlanI think the existing patch is still the best approach - @andypost - can you review?
Comment #26
yoroy CreditAttribution: yoroy at Roy Scholten commentedI'm late to this particular party. Initial thought on first read of the issue summary was "why would we want to list the entities you can *not* add comments to?". It mostly lists stuff you likely don't want to add comments to anyway. Of course there will be exotic use cases where it would be needed. But that is not fixed by actually spelling out that you can’t anyway. I don't think we should explain up front why a certain technical limitation is reducing available options.
Not sure we need to call it out at all. If people feel strongly about somehow explaining this somewhere:
- Consider mentioning this in /admin/help/comment
- Have a "Missing some options here?" link to an explanation somewhere else (either the above help page or d.o)
But even as I type out these options I'm not sure it's helpful explaining this on the UI level *if there's nothing you can do to work around it*.
Comment #34
jungle+1 to #26, the current patch lists the unsupported entity types without an explanation which is confusing and against what this CR claimed: Comments allowed on any entity type.
However, telling site builders/drupal users the truth directly on the add comment field page, that comments does not work on string ID-based entity types, which sounds like Drupal sucks. Further more, some of them won't encounter it.
Comment #35
jonathanshawI think we'd all agree that what's most important here is hiding the entity types that don't work in the drop-down. Currently this is labelled a major bug.
What we should do explain this to users could be a lower priority follow-up task.
Let's simplify #11 to the actual uncontroversial bug fix and get it in first.
Comment #36
jungleWell, made a patch based on #11, tagging Bug Smash Initiative
Comment #37
jungleSelf-review: should not remove the comment.
Comment #40
mohit_aghera CreditAttribution: mohit_aghera at QED42 commentedFixing the test cases.
I think in test cases we were asserting incorrect checks.
We should check "responseNotContains()". The reason is, we are expecting that entities with integer id should appear in the list.
Test is passing on local now.
Comment #41
jonathanshawSeems right to me.
Comment #43
jonathanshawComment #44
benjifisherPlease do not ask the testbot to try again until #3207086: [HEAD BROKEN] Consistent failure in MonthDatePluginTest is fixed.
Comment #45
alexpott#3207086: [HEAD BROKEN] Consistent failure in MonthDatePluginTest is fixed. I have not reviewed the code.
Comment #48
catchGood to see this RTBC after so long. If we ever make comments work with string ID entity types we can reverse it of course.
Committed/pushed to 9.2.x and cherry-picked to 9.1.x, thanks!