WordPress.org

Make WordPress Core

Opened 5 weeks ago

Closed 2 weeks ago

Last modified 2 weeks ago

#40213 closed enhancement (fixed)

REST API: Users endpoint slug parameter should allow an array of slugs

Reported by: curdin Owned by: jnylen0
Milestone: 4.7.4 Priority: normal
Severity: normal Version: 4.7
Component: REST API Keywords: has-patch has-unit-tests fixed-major i18n-change
Focuses: rest-api Cc:

Description

The users endpoint should allow an array or csv to be passed into the slug parameter, matching user slugs with any value in the array. At current it is limited to deal with strings as discovered while working on #40027.

This change would provide consistency with the other endpoints.

Related: #38579

Attachments (3)

40213.diff (1.5 KB) - added by MatheusGimenez 5 weeks ago.
Added support to array and comma-separated to slug param
40213.1.diff (4.5 KB) - added by curdin 5 weeks ago.
Added unit tests
40213.2.diff (4.2 KB) - added by jnylen0 3 weeks ago.
Minor updates (tests and formatting)

Download all attachments as: .zip

Change History (14)

@MatheusGimenez
5 weeks ago

Added support to array and comma-separated to slug param

#1 @MatheusGimenez
5 weeks ago

  • Keywords has-patch needs-testing needs-unit-tests added

@curdin
5 weeks ago

Added unit tests

#2 @curdin
5 weeks ago

  • Keywords has-unit-tests added; needs-unit-tests removed

Have added unit tests to @MatheusGimenez 's patch

#3 @curdin
5 weeks ago

@jnylen0 This is ready for review - might be worthwhile committing it with #40027 if you're happy with it.

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


5 weeks ago

#5 @swissspidy
5 weeks ago

  • Milestone changed from Awaiting Review to 4.7.4

Moving to the milestone for consideration.

@jnylen0
3 weeks ago

Minor updates (tests and formatting)

#6 @jnylen0
3 weeks ago

  • Keywords commit added; needs-testing removed

With some minor updates to tests and formatting (whitespace, etc) in 40213.2.diff, this is looking good and working well. Nice catch on getting rid of the search thing as well, I believe that previously slug would have overridden any search parameter. Committing when tests pass.,

#7 @jnylen0
3 weeks ago

  • Owner set to jnylen0
  • Resolution set to fixed
  • Status changed from new to closed

In 40378:

REST API: Allow fetching multiple users at once via the slug parameter.

This matches similar changes previously made for posts (#38579) and terms (#40027).

Props curdin, MatheusGimenez.
Fixes #40213.

#8 @jnylen0
3 weeks ago

  • Keywords fixed-major added; commit removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening for backport to 4.7 branch.

#9 @jnylen0
3 weeks ago

  • Keywords i18n-change added

Note this includes a string change (cc @ocean90). See also: ticket:40027#comment:22

#10 @swissspidy
2 weeks ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 40426:

REST API: Allow fetching multiple users at once via the slug parameter.

This matches similar changes previously made for posts (#38579) and terms (#40027).

Props curdin, MatheusGimenez.
Fixes #40213.

Merges [40378] to the 4.7 branch.

#11 @swissspidy
2 weeks ago

Note that I merged this to the 4.7 branch without the string change as none of the other string changes from the mentioned tickets have made it into this release. Better to keep it that way, given that we now release much earlier than originally planned.

Note: See TracTickets for help on using tickets.