Implement filters in the API for tags, statuses, and focus areas
Closed, ResolvedPublic5 Estimated Story Points

Description

Split from T400414.

Add three new parameters to the action=query&list=communityrequests-wishes API (all accept the wikitext value forms of the wish attributes):

  1. Tags: crwtags, one or more tags.
  2. Statuses: crwstatuses, one or more status names.
  3. Focus Areas: crwfocusareas, one or more FAx Focus Area IDs.
Developer notes
  • In ApiQueryWishes, add new entries to getAllowedParams() for the new parameters.
    • PARAM_ISMULTI should be true
    • Set the PARAM_TYPE to be the allowed wikitext values as fetched from configuration, like array_keys( $this->config->getNavigationTags() )
  • In AbstractWishlistStore::getAll(), make the $filters param work
    • Could maybe accept the same signature as SelectQueryBuilder::where() and use $select->andWhere( $filters );; see incomplete attempt in r1185177 (?)
Acceptance criteria
  • Querying ApiQueryWishes with the tags param should return the tags of wishes, in their API-compatible "wikitext value" format (i.e. botsgadgets, mobileweb)

__

Derived Requirement

Enhance the action=query&list=communityrequests-wishes API to support filtering of wish results by tags, statuses, and focus areas. The API should accept the following new parameters:

  • crwtags: One or more tag identifiers (wikitext value format, e.g., botsgadgets, mobileweb)
  • crwstatuses: One or more status names
  • crwfocusareas: One or more Focus Area IDs (e.g., FA1, FA2)

Each parameter must allow multiple values (PARAM_ISMULTI set to true), with PARAM_TYPE restricted to valid configuration-defined values. When these parameters are used in a query, the API must correctly return filtered wish results that match the specified criteria, ensuring that returned data reflects only relevant wishes based on the filters applied.

Test Steps

Test Case 1: Verify filtering by tags

  1. Send an API request to:

    ` action=query&list=communityrequests-wishes&crwtags=botsgadgets `
  2. ✅❓❌⬜ AC1: Confirm that only wishes tagged with botsgadgets are returned.

Test Case 2: Verify filtering by multiple tags

  1. Send an API request to:

    ` action=query&list=communityrequests-wishes&crwtags=botsgadgets|mobileweb `
  2. ✅❓❌⬜ AC2: Confirm that all returned wishes include at least one of the specified tags (botsgadgets, mobileweb).

Test Case 3: Verify filtering by status

  1. Send an API request to:

    ` action=query&list=communityrequests-wishes&crwstatuses=inprogress `
  2. ✅❓❌⬜ AC3: Confirm that only wishes with the inprogress status are returned.

Test Case 4: Verify filtering by focus area

  1. Send an API request to:

    ` action=query&list=communityrequests-wishes&crwfocusareas=FA1 `
  2. ✅❓❌⬜ AC4: Confirm that only wishes belonging to the specified focus area (FA1) are returned.

QA Results - Meta Beta

Event Timeline

MusikAnimal triaged this task as High priority.

Change #1185307 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/extensions/CommunityRequests@master] [WIP] Add 'filters' to ApiQueryWishes

https://gerrit.wikimedia.org/r/1185307

Samwilson renamed this task from Implement filters in the store and add tags param to ApiQueryWishes to Implement filters in the API for tags, statuses, and focus areas.Sep 9 2025, 7:49 AM
Samwilson updated the task description. (Show Details)

I realised a bit late that the statuses and focus areas also need to be multiple. Working on that now.

KSiebert set the point value for this task to 5.Sep 9 2025, 7:54 PM

Change #1185307 merged by jenkins-bot:

[mediawiki/extensions/CommunityRequests@master] Add 'filters' to ApiQueryWishes

https://gerrit.wikimedia.org/r/1185307

MusikAnimal changed the task status from Open to In Progress.Sep 24 2025, 9:11 PM
Samwilson changed the task status from In Progress to Open.Sep 29 2025, 8:28 AM

@Samwilson Confirmed filters in the API for tags, statuses, and focus areas, as seen in the screenshots. I will mark this as Resolved. Thanks for all your work!

Test Result - Meta Beta

Status: ✅ PASS
Environment: Meta Beta
OS: macOS Tahoe 26.0.1
Browser: Chrome 140
Device: MBA
Emulated Device: NA

Test Artifact(s):

https://meta.wikimedia.beta.wmcloud.org/wiki/Special:ApiSandbox#action=query&format=json&list=communityrequests-wishes&formatversion=2&crwtags=mobileweb%7Cbotsgadgets

Test Steps

Test Case 1: Verify filtering by tags

  1. Send an API request to:

    ` action=query&list=communityrequests-wishes&crwtags=botsgadgets `
  2. AC1: Confirm that only wishes tagged with botsgadgets are returned.

2025-10-07_09-14-55.png (1×1 px, 220 KB)

Test Case 2: Verify filtering by multiple tags

  1. Send an API request to:

    ` action=query&list=communityrequests-wishes&crwtags=botsgadgets|mobileweb `
  2. AC2: Confirm that all returned wishes include at least one of the specified tags (botsgadgets, mobileweb).

2025-10-07_09-18-05.png (1×1 px, 198 KB)

Test Case 3: Verify filtering by status

  1. Send an API request to:

    ` action=query&list=communityrequests-wishes&crwstatuses=inprogress `
  2. AC3: Confirm that only wishes with the inprogress status are returned.

2025-10-07_09-21-18.png (1×1 px, 193 KB)

Test Case 4: Verify filtering by focus area

  1. Send an API request to:

    ` action=query&list=communityrequests-wishes&crwfocusareas=FA1 `
  2. AC4: Confirm that only wishes belonging to the specified focus area (FA1) are returned.

2025-10-07_09-22-52.png (1×1 px, 208 KB)

All

2025-10-07_09-10-41.png (857×1 px, 199 KB)

GMikesell-WMF updated Other Assignee, removed: GMikesell-WMF.
GMikesell-WMF updated the task description. (Show Details)