Checking for duplicate emails in user_requirements() does not take langcode into account

Created on 29 November 2024, 5 months ago

Problem/Motivation

The users_field_data table has a langcode field, which allows translating users. When this is the case, the check in user_requirements() adds a warning to the status report page about conflicting user names, while this is technically the same user.

Steps to reproduce

  1. Translate a user account in multiple language
  2. Observe the warning on the status report page

Proposed resolution

When checking for conflicting user mails, we should probably take the langcode and UID into account as well.

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component

user system

Created by

πŸ‡³πŸ‡±Netherlands seanB Netherlands

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

Merge Requests

Comments & Activities

  • Issue created by @seanB
  • Pipeline finished with Success
    5 months ago
    Total: 1559s
    #354185
  • First commit to issue fork.
  • πŸ‡ͺπŸ‡ΈSpain pcambra Asturies

    I just found this issue myself, I think it doesn't really matter to group by uid, but we definitely need to group by language.

  • Pipeline finished with Success
    2 months ago
    Total: 380s
    #428562
  • πŸ‡¬πŸ‡§United Kingdom catch

    I think we could add some additional coverage to UserRequirementsTest for this - might just be a case of adding some more data.

  • Status changed to Needs work 7 days ago
  • First commit to issue fork.
  • Pipeline finished with Canceled
    7 days ago
    Total: 92s
    #478892
  • Pipeline finished with Success
    7 days ago
    Total: 633s
    #478893
  • πŸ‡ΊπŸ‡ΈUnited States dcam

    I added a test.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Test coverage added

    1) Drupal\Tests\user\Kernel\UserRequirementsTest::testTranslatedUserEmail
    Failed asserting that an array does not have the key 'conflicting emails'.
    /builds/issue/drupal-3490639/core/modules/user/tests/src/Kernel/UserRequirementsTest.php:80
    FAILURES!
    Tests: 3, Assertions: 20, Failures: 1.
    

    Fix itself seems pretty simple enough

    LGTM

  • πŸ‡ΊπŸ‡ΈUnited States w01f

    Confirmed changes in fork branch to the two core user files resolves the issue on a new Drupal 11.6 install with multiple languages.

Production build 0.71.5 2024