Page MenuHomePhabricator

Vote count isn't changed to zero when all votes are removed
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Add a vote to a wish
  • Observe the vote count in the wish-index table
  • Remove the vote by blanking the page
  • Go back to the wish index

What happens?:

The wish still has >= 1 votes.

What should have happened instead?:

It should have 0 votes, since all votes were removed.


Derived Requirement

Ensure that the vote count for a wish in the wish-index table updates to zero when all associated votes are removed.

Test Steps

Test Case 1: Verify Vote Count Updates to Zero When All Votes Are Removed

  1. Navigate to the Community Wishlist/Wishes page on beta or the relevant test wiki.
  2. Locate an existing wish in the wish-index table.
  3. Add a vote to the wish.
  4. Observe and record the current vote count displayed for the wish.
  5. Remove the vote by blanking the page (deleting vote content).
  6. Return to the wish-index page and refresh it.
  7. ✅❓❌⬜ AC1: Confirm that the vote count for the wish has updated to 0 after all votes were removed.
  8. ✅❓❌⬜ AC2: Confirm that no cached or stale vote count (≥1) is displayed in the wish-index after removal.

QA Results - Meta Beta

ACStatusDetails
1T406669#11341024
2T406669#11341024

Event Timeline

dmaza subscribed.

I'm gonna give a shot at this but I'm not sure how to approach it. We count votes when we render them, so if there are not calls to the parser function the count is just ignored and thus this issue. I think we need special handling for votes pages on onLinksUpdateComplete perhaps? Open to ideas

dmaza changed the task status from Open to In Progress.Oct 10 2025, 3:16 PM

I'm gonna give a shot at this but I'm not sure how to approach it. We count votes when we render them, so if there are not calls to the parser function the count is just ignored and thus this issue. I think we need special handling for votes pages on onLinksUpdateComplete perhaps? Open to ideas

Yep! onLinksUpdateComplete will always get called, so you can look for empty ParserOutput and a truthy $this->config->isVotesPage( $title ) as the indicator that the vote count needs to be updated to 0. We'll have to reload the entity regardless so you can check if the existing vote count is 0, too, so we don't make redundant updates to the DB.

Change #1196951 had a related patch set uploaded (by Dmaza; author: Dmaza):

[mediawiki/extensions/CommunityRequests@master] [WIP]

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

Change #1196951 merged by jenkins-bot:

[mediawiki/extensions/CommunityRequests@master] Fix vote count when parser function is not present

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

MusikAnimal changed the task status from In Progress to Open.Oct 29 2025, 5:19 AM

@dmaza Confirmed the vote count now changes to zero when all votes are removed, as seen in the video. I will move this to Resolved. Thanks for all your work!

Test Result - Meta Beta

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

Test Artifact(s):

Test Steps

Test Case 1: Verify Vote Count Updates to Zero When All Votes Are Removed

  1. Navigate to the Community Wishlist/Wishes page on beta or the relevant test wiki.
  2. Locate an existing wish in the wish-index table.
  3. Add a vote to the wish.
  4. Observe and record the current vote count displayed for the wish.
  5. Remove the vote by blanking the page (deleting vote content).
  6. Return to the wish-index page and refresh it.
  7. AC1: Confirm that the vote count for the wish has updated to 0 after all votes were removed.

  1. ✅ AC2: Confirm that no cached or stale vote count (≥1) is displayed in the wish-index after removal.

See AC1

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