Views' User Name exposed group filter validation

Created on 31 October 2017, about 7 years ago
Updated 16 December 2024, 2 days ago

Problem/Motivation

When adding an exposed and grouped user_name filter, the value doesn't validate correctly. It issue stems from the entity reference autocomplete field handling values using the target_id key, and loaded entities.

This is exactly the same issue as reported in πŸ› Grouped exposed taxonomy filter fails validation for autocomplete widget Needs work . Please check it out for more details.

Other changes applied in the merge request are just allowed new tests to pass. There were 2 issues:
1) Default value of the filter was trying to be processed twice but failed with the exception. More information is in duplicated issue: #3250352: Username views filter should not process default value twice β†’ . Fixed in this commit: https://git.drupalcode.org/project/drupal/-/merge_requests/1445/diffs?co...
2) There was a PHP notice in \Drupal\user\Plugin\views\filter\Name::validateExposed method, that was fixed in this commit: https://git.drupalcode.org/project/drupal/-/merge_requests/1445/diffs?co...

Steps to reproduce

  1. Install Drupal with "Standard" profile
  2. Open content view (/admin/structure/views/view/content)
  3. Add an exposed grouped filter by "Authored by" (User). Make sure the group item is using autocomplete widget
  4. Add at least one item to the group configuration (e.g. "admin")
  5. Submit

Proposed resolution

Apply the same fix and test coverage as in πŸ› Grouped exposed taxonomy filter fails validation for autocomplete widget Needs work . Also, make additional fixes to let tests pass.

Remaining tasks

Review, commit.

There are no User interface, API or Data model changes.

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
ViewsΒ  β†’

Last updated about 5 hours ago

Created by

πŸ‡ΊπŸ‡ΈUnited States grathbone

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • The Needs Review Queue Bot β†’ tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

    Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.

    Consult the Drupal Contributor Guide β†’ to find step-by-step guides for working with issues.

  • First commit to issue fork.
  • Pipeline finished with Failed
    2 days ago
    Total: 348s
    #370070
  • πŸ‡ͺπŸ‡ΈSpain pcambra Asturies

    Damn, according to https://www.drupal.org/docs/develop/git/using-gitlab-to-contribute-to-dr... β†’ , only the original creator of an MR can change the base branch :(

  • Pipeline finished with Failed
    2 days ago
    Total: 722s
    #370086
  • Pipeline finished with Failed
    2 days ago
    Total: 912s
    #370106
  • πŸ‡³πŸ‡±Netherlands Lendude Amsterdam

    @pcambra I think everybody in maintainers.txt can change target branches in MRs now, so updated it to 11.x, but that still doesn't seem right looking at the changes. Is 11.x the correct branch to target?

  • Pipeline finished with Failed
    1 day ago
    Total: 194s
    #371440
  • πŸ‡ͺπŸ‡ΈSpain pcambra Asturies

    I think this is what phpstan doesn't like but the parent doesn't have return type either, I think it should be :void but not sure if it needs to happen in this issue.

      Line   core/modules/user/src/Plugin/views/filter/Name.php                    
     ------ ---------------------------------------------------------------------- 
      169    Method                                                                
             Drupal\user\Plugin\views\filter\Name::buildExposedFiltersGroupForm()  
             has no return type specified.  
    
Production build 0.71.5 2024