Make WordPress Core

Opened 13 months ago

Last modified 6 months ago

#60317 new defect (bug)

Cannot select an author from dropdown due to truncated users list

Reported by: yanksyoon's profile yanksyoon Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Editor Keywords:
Focuses: ui Cc:

Description

Hello team!

Currently, when we have over 50 users with same email signatures, e.g. over 50 users with email @zemail.com (with usernames starting with characters preceding z), and there is a user with username zemail, the user zemail can never appear in the dropdown since the request made by the dropdown
http://<wordpress-link>/index.php?rest_route=%2Fwp%2Fv2%2Fusers&context=view&who=authors&per_page=50&_fields=id%2Cname&search=zemail&_locale=user is sorted alphabetically.

This makes it impossible for the user to be selected as an author of a new post.
Would the search be better limited to usernames?

Attachments (1)

Screenshot 2024-01-24 at 10.56.11 AM.png (162.5 KB) - added by yanksyoon 13 months ago.
Searching for the user "amailer" shows no matching results.

Download all attachments as: .zip

Change History (8)

#1 @hardikgohil
13 months ago

  • Keywords needs-testing-info reporter-feedback added
Last edited 13 months ago by hardikgohil (previous) (diff)

This ticket was mentioned in Slack in #core-test by hardikgohil. View the logs.


13 months ago

#3 @hardikgohil
13 months ago

  • Keywords needs-testing-info reporter-feedback removed

@yanksyoon
13 months ago

Searching for the user "amailer" shows no matching results.

#4 @yanksyoon
13 months ago

  • Keywords needs-testing-info reporter-feedback added

Here's the payload for the search request on the dropdown. As you can see, the user amailer is truncated.

Request URL: http://10.1.190.162/index.php?rest_route=%2Fwp%2Fv2%2Fusers&context=view&who=authors&per_page=50&_fields=id%2Cname&search=amailer&_locale=user

[
    {
        "id": 121,
        "name": "a00nBHN2n"
    },
    {
        "id": 128,
        "name": "a0FG5fai8"
    },
    {
        "id": 122,
        "name": "a0zqyu52Y"
    },
    {
        "id": 152,
        "name": "a1WlKgRrd"
    },
    {
        "id": 139,
        "name": "a2JOvoK4U"
    },
    {
        "id": 126,
        "name": "a3MvWRle4"
    },
    {
        "id": 131,
        "name": "a4DE589VL"
    },
    {
        "id": 150,
        "name": "a4O977lDb"
    },
    {
        "id": 106,
        "name": "a5d0lr7Xj"
    },
    {
        "id": 143,
        "name": "a5RtDr3m8"
    },
    {
        "id": 146,
        "name": "a9N95Xz08"
    },
    {
        "id": 109,
        "name": "a9rELNii5"
    },
    {
        "id": 138,
        "name": "aaa5avW2x"
    },
    {
        "id": 117,
        "name": "aaX3JfIcS"
    },
    {
        "id": 196,
        "name": "ab0BLAopL2"
    },
    {
        "id": 194,
        "name": "ab2Vrf7jPi"
    },
    {
        "id": 136,
        "name": "aB3FWIEC8"
    },
    {
        "id": 110,
        "name": "aB3ssFopr"
    },
    {
        "id": 189,
        "name": "ab6JgXByP1"
    },
    {
        "id": 165,
        "name": "ab7rWeIuRx"
    },
    {
        "id": 154,
        "name": "ab7Wx140Mc"
    },
    {
        "id": 169,
        "name": "ab8eCP8wee"
    },
    {
        "id": 170,
        "name": "ab8tLFxn8P"
    },
    {
        "id": 185,
        "name": "abBt2yCmha"
    },
    {
        "id": 155,
        "name": "abCCmOzobH"
    },
    {
        "id": 184,
        "name": "abCmJGbB7A"
    },
    {
        "id": 161,
        "name": "abCPhCQ7Ti"
    },
    {
        "id": 182,
        "name": "abddaHKfBJ"
    },
    {
        "id": 198,
        "name": "abeLexYU44"
    },
    {
        "id": 173,
        "name": "abEME8SCme"
    },
    {
        "id": 193,
        "name": "abF5dSkbjA"
    },
    {
        "id": 181,
        "name": "abGcPmvw7L"
    },
    {
        "id": 202,
        "name": "abGjvETaMU"
    },
    {
        "id": 180,
        "name": "abh6k1NoFr"
    },
    {
        "id": 195,
        "name": "abH7oqnhtu"
    },
    {
        "id": 197,
        "name": "abIFhNp5qS"
    },
    {
        "id": 171,
        "name": "abiNTHdQwj"
    },
    {
        "id": 176,
        "name": "abISC0qaHt"
    },
    {
        "id": 164,
        "name": "abjVDnDCiH"
    },
    {
        "id": 187,
        "name": "abkiEL8UYR"
    },
    {
        "id": 167,
        "name": "abKXGWYell"
    },
    {
        "id": 178,
        "name": "ablNFeBciS"
    },
    {
        "id": 160,
        "name": "ablR2PTwtl"
    },
    {
        "id": 168,
        "name": "abM7o9SOhv"
    },
    {
        "id": 159,
        "name": "abNZeGAmky"
    },
    {
        "id": 179,
        "name": "abnZfp9hwI"
    },
    {
        "id": 188,
        "name": "abO8Guw00q"
    },
    {
        "id": 158,
        "name": "abOKFtUx7d"
    },
    {
        "id": 186,
        "name": "abpzuABnpt"
    },
    {
        "id": 174,
        "name": "abq6wgH2yB"
    }
]

The script to generate random users:

---
#!/bin/bash

# Function to generate a random username beginning with 'ab'
generate_username() {
  local username
  username="ab"

  # Generate a random string of characters
  random_string=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 8 | head -n 1)

  # Append the random string to the username
  username+="${random_string}"

  echo "$username"
}

# Iterate to create 50 users
for ((i=1; i<=50; i++)); do
  # Generate a random username
  random_username=$(generate_username)

  # Create WordPress user
  wp --allow-root user create "$random_username" "$random_username@amailer.com" --role=author

  echo "Created user: $random_username"
done
---

Then, generate the target user:
wp --allow-root user create amailer amailer@amailer.com --role=author

Goto create post.
Select author dropdown on the right panel.
Search for amailer user.
The user is not found in the dropdown.

Last edited 12 months ago by sabernhardt (previous) (diff)

#5 @yanksyoon
12 months ago

@hardikgohil Hello :D I've attached the required documents for this bug, may I know the status of this issue please?

This ticket was mentioned in Slack in #core by yanksyoon. View the logs.


10 months ago

#7 @swissspidy
10 months ago

  • Component changed from General to Editor
  • Focuses rest-api removed
  • Keywords needs-testing-info reporter-feedback removed
  • Severity changed from major to normal

Tickets related to the Gutenberg Editor should be filed on the Gutenberg GitHub Repository.

Note: See TracTickets for help on using tickets.