Page MenuHomePhabricator

Parser function to retrieve data for a focus area or wish
Closed, ResolvedPublicFeature

Assigned To
Authored By
Samwilson
Oct 7 2025, 2:38 AM
Referenced Files
F69899232: 2025-11-04_14-23-41.webm
Nov 4 2025, 10:30 PM
F69899226: 2025-11-04_14-20-56.png
Nov 4 2025, 10:30 PM
F69899197: 2025-11-04_14-15-36.png
Nov 4 2025, 10:30 PM
F69898820: 2025-11-04_09-47-22.png
Nov 4 2025, 10:30 PM
F69898818: 2025-11-04_09-47-03.png
Nov 4 2025, 10:30 PM
F69898812: 2025-11-04_09-46-43.png
Nov 4 2025, 10:30 PM
F69898815: 2025-11-04_09-46-25.png
Nov 4 2025, 10:30 PM
F69898810: 2025-11-04_09-45-34.png
Nov 4 2025, 10:30 PM

Description

(Suggested by @Nardog at https://meta.wikimedia.org/wiki/Talk:Community_Wishlist#c-Nardog-20251005135000-Converting_wish_number_to_wish_title )

Create a {{#CommunityRequests: data | id=W123 | field=[field_name] }} parser function that takes a wish or focus area identifier and returns the requested field as a wikitext value. The fields names are status, focus_area, proposer, vote_count, title, title_lang.


Derived Requirement
Provide a new parser function {{#CommunityRequests:entityData|…}} that accepts either a focus-area ID or wish ID (or title) and returns structured metadata for that entity (such as title, status, vote count, creation date, assigned focus area for wishes, etc.). The function must handle both wish and focus-area entities, resolve the appropriate entity type, fetch the data reliably (via the Extension:CommunityRequests store) and output valid HTML (or JSON as configured) that can be embedded in wikitext.

Test Result - Beta|Prod

Status: ✅ PASS / ❓Need More Info / ❌ FAIL
Environment: beta/xyzwiki
OS: macOS Tahoe 26.1
Browser: Chrome 142
Device: MBA
Emulated Device: NA

Test Artifact(s):

Test Steps

Test Case 1: Parser function returns correct data for a wish entity

  1. On the beta wiki, create or locate a test wish entity (e.g., with ID “W123”).
  2. Edit a talk page and insert the parser function: {{#CommunityRequests:Data|wish=W26}| field= <field name> }}.
  3. Save the page and review the rendered output.
  4. ✅❓❌⬜AC1: Confirm the output shows the correct status, focus_area, proposer, vote_count, title, title_lang of the wish.

Test Case 2: Error handling and invalid input

  1. Insert the parser function with a non-existent ID: {{#CommunityRequests:Data|wish=W999999}}.
  2. Save the page and review the rendered output.
  3. ✅❓❌⬜ AC2: Confirm the output shows a meaningful error or fallback message (e.g., “Wish W999999 not found”).
  4. Insert the parser function with missing parameters: {{#CommunityRequests:Data}}.
  5. Save the page and review the output.
  6. ✅❓❌⬜ AC3: Confirm the output shows a meaningful usage or error message indicating that either ‘wish’ or ‘focusarea’ parameter is required.

Test Case 3: Performance / caching behavior

  1. On the sandbox page for a wish using the parser function, open browser dev tools and clear cache.
  2. Reload the page and measure load time for the parser output.
  3. Modify the underlying wish (e.g., change title or vote count).
  4. Reload the page again.
  5. ✅❓❌⬜AC4: Confirm the updated data appears in the parser function output without excessive caching delays (within acceptable thresholds e.g., < 2s).

QA Results - Meta Beta

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

A more scalable approach would be a parser function that returns the specified property given a wish or focus area number, e.g. {{#CommunityRequests:link|W123}} returns the title, {{#CommunityRequests:link|W123|status}} (or {{#CommunityRequests:link|id=W123|prop=status}}) returns the status, and so on. Then a template can be created e.g. [[Special:MyLanguage/Community Requests/{{1}}}|{{{1}}}: {{#CommunityRequests:link|{{{1}}}}}]]. That way each editor can use whatever markup.

That's a good idea, although perhaps the call should just be called data rather than link in that case.

The fields that can be provided are status, focus_area (for wishes), vote_count, title, and title_lang.

Samwilson renamed this task from Parser function for easier linking to Wx or FAx with title to Parser function to retrieve data for a focus area or wish.Oct 7 2025, 5:02 AM

Just a minor note: it would be great if links to phab code issues linked like [[phab:Tid]] across the Wikimedia projects (such as here) would also show the issue title, for example when hovering over the link. This is pretty similar to what's suggested here but since phab is not a wiki, it may not be readily possible and if it is possible probably in a quite different way than for wishes. If however there is a way to implement this, please let me know so a separate issue can be created.

I've often wondered why we don't have the ability to do that, it'd be really useful! There are some gadgets that do it, but really we should make a proper extension. As it's something that'd be useful on all wikis, it probably doesn't make sense to build it into CommunityRequests.

mikez-WMF removed a project: Community-Tech.

There should also be a parser function to retrieve the vote count for a particular wish or area.

Change #1198675 had a related patch set uploaded (by MusikAnimal; author: MusikAnimal):

[mediawiki/extensions/CommunityRequests@master] EntityDataRenderer: Parser function to retrieve data for an entity

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

Change #1198675 merged by jenkins-bot:

[mediawiki/extensions/CommunityRequests@master] EntityDataRenderer: Parser function to retrieve data for an entity

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

@MusikAnimal: The confirmed parser function to retrieve data, as mentioned in the Description, works properly, as seen in the screenshots and videos below. I will move this to Sign-off. Thanks for all your work!

Test Result - Meta Beta

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

Test Artifact(s):

Test Steps

Test Case 1: Parser function returns correct data for a wish entity

  1. On the beta wiki, create or locate a test wish entity (e.g., with ID “W123”).
  2. Edit a talk page and insert the parser function: {{#CommunityRequests:Data|wish=W26}| field= <field name> }}.
  3. Save the page and review the rendered output.
  4. AC1: Confirm the output shows the correct status, focus_area, proposer, vote_count, title, title_lang of the wish.
Wish Edit with form W26Wish- Page info W26Focus Area- Page info FA12
2025-11-04_12-30-28.png (998×878 px, 231 KB)
2025-11-04_09-31-55.png (1×971 px, 164 KB)
2025-11-04_09-32-10.png (1×960 px, 174 KB)
StatusFocus AreaProposerVote CountTitleTitle Lang
2025-11-04_09-46-04.png (756×911 px, 88 KB)
2025-11-04_09-45-34.png (1×1 px, 149 KB)
2025-11-04_09-46-25.png (795×924 px, 93 KB)
2025-11-04_09-46-43.png (765×777 px, 82 KB)
2025-11-04_09-47-03.png (770×723 px, 81 KB)
2025-11-04_09-47-22.png (767×732 px, 81 KB)

Test Case 2: Error handling and invalid input

  1. Insert the parser function with a non-existent ID: {{#CommunityRequests:Data|wish=W999999}}.
  2. Save the page and review the rendered output.
  3. AC2: Confirm the output shows a meaningful error or fallback message (e.g., “Wish W999999 not found”).

2025-11-04_14-15-36.png (912×1 px, 128 KB)

  1. Insert the parser function with missing parameters: {{#CommunityRequests:Data}}.
  2. Save the page and review the output.
  3. AC3: Confirm the output shows a meaningful usage or error message indicating that either ‘wish’ or ‘focusarea’ parameter is required.

2025-11-04_14-20-56.png (917×847 px, 97 KB)

Test Case 3: Performance / caching behavior

  1. On the sandbox page for a wish using the parser function, open browser dev tools and clear cache.
  2. Reload the page and measure load time for the parser output.
  3. Modify the underlying wish (e.g., change title or vote count).
  4. Reload the page again.
  5. AC4: Confirm the updated data appears in the parser function output without excessive caching delays (within acceptable thresholds e.g., < 2s).

GMikesell-WMF updated the task description. (Show Details)
GMikesell-WMF updated the task description. (Show Details)
Nardog changed the status of subtask T409614: DELETED from Duplicate to Invalid.Nov 8 2025, 2:48 AM
Nardog removed a subtask: T409614: DELETED.