Problem/Motivation

Drupal 10.1.0 introduced a validation message "Comments field is required" when creating a content item for a content type that has comments set to hidden.

Steps to reproduce

Configure comment field on type Article to be "Hidden". Create an article, fill in title only and try to save.

Proposed resolution

I traced this back to #3347296: Conditionally show default value fields, which changed the comment settings field to a required field, regardless of the form being rendered on the administration page or the content creation page.
Somehow conditionally setting required to TRUE could bring back the old behaviour, I guess.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

Eric_A created an issue. See original summary.

eric_a’s picture

Component: field_ui.module » comment.module

The issue that accidentally broke the node form was filed in the "field_ui.module" component, but I guess the bug it introduced should be in comment.module.

lauriii’s picture

Status: Active » Needs review
Issue tags: +Needs tests
StatusFileSize
new1.28 KB

Probably still need to write some tests for this. I couldn't find existing test coverage for this 😬

lauriii’s picture

Issue tags: -Needs tests
StatusFileSize
new1.51 KB
new2.78 KB

And here's some additional test coverage for this. The test only patch is also the interdiff.

lauriii’s picture

Opened follow-up to clean this up a bit: #3373938: Comment settings are confusing.

The last submitted patch, 4: 3373867-4-test-only.patch, failed testing. View results

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Verified this issue following the steps in the summary. Also shown by the test-only patch.
#4 solved the issue.

  • catch committed 37dd50f5 on 10.1.x
    Issue #3373867 by lauriii, Eric_A, smustgrave: [regression] "Comments...

  • catch committed 9028e6c0 on 11.x
    Issue #3373867 by lauriii, Eric_A, smustgrave: [regression] "Comments...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 11.x and cherry-picked to 10.1.x, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.