On the HelpfulnessBlockForm validateForm() method:

 $comment_required = $config->get('helpfulness_comment_required') ?? 0;
    if (!$comment_required) {
      $comment_text = strip_tags($form_state->getValue('helpfulness_comments'));
      if (strlen($comment_text) < 1) {
        $form_state->setErrorByName('helpfulness_comments', $config->get('helpfulness_comment_required_message'));
      }
    }

The "Comment required" configuration check when we submit the form is flipped. It's throwing the "This comment is required" error message when the comment is not required, and no message when it is required.

Simply taking off the negation is enough.

I'll create a new bugfix release out of it, as I feel it is impactful enough to be included ASAP.

Comments

gueguerreiro created an issue. See original summary.

  • gueguerreiro committed 3cbb6f8 on 2.x
    Issue #3168677 by gueguerreiro: Comment required condition is flipped
    
gueguerreiro’s picture

Committed 3cbb6f8 and pushed to 2.x. Thanks!

I'll cherry pick it into the 8.x-1.x branch as well.

  • gueguerreiro committed 7569741 on 8.x-1.x
    Issue #3168677 by gueguerreiro: Comment required condition is flipped
    
gueguerreiro’s picture

Status: Active » Fixed

Committed 7569741 and pushed to 8.x-1.x. Thanks!

Status: Fixed » Closed (fixed)

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