Page MenuHomePhabricator

ImageRating failing to list newest images when they are unrated
Open, Needs TriagePublicBUG REPORT

Description

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

  • Upload an image
  • Go to Special:ImageRating&type=new

What happens?:
No image is shown.

What should have happened instead?:
Newly uploaded image is shown.

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):
MediaWiki: 1.45.1 (30bca66)
ImageRating: 2.6.0 (04603aa)

Event Timeline

The problematic SQL is

SELECT page_id,page_title,COUNT(vote_value),AVG(vote_value) AS vote_avg FROM `page` LEFT JOIN `Vote` ON ((page_id = vote_page_id)) WHERE page_namespace = 6 AND (vote_page_id = page_id) GROUP BY page_id, page_title ORDER BY page_id DESC LIMIT 5;

The vote_page_id = page_id in the WHERE clause is the cause. If no rating exists for the image, the left join would result in null values for all fields in the Vote table, so the equality comparison will always fail. This WHERE clause is redundant anyway since page_id = vote_page_id is specified in the join already.

I'm not sure if this counts as a real bug since it's assumed that ImageRating only shows pages (in NS_FILE) which have the VoteNY star rating tag (<vote type=1 />) in them. Perhaps the UI/i18n could be made clearer to indicate that "newest" doesn't mean "newest uploads" but rather "newest uploads which have been tagged as rateable" or somesuch...

Thanks for the quick reply. I suppose this is more of a documentation issue then since https://www.mediawiki.org/wiki/Extension:ImageRating doesn't mention the need to explicitly add <vote type=1 /> to uploaded file pages.

Change #1228267 had a related patch set uploaded (by SarthakSingh2904; author: SarthakSingh2904):

[mediawiki/extensions/ImageRating@master] Fix Special:ImageRating to show unrated images

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

Change #1228267 merged by jenkins-bot:

[mediawiki/extensions/ImageRating@master] Fix Special:ImageRating to show unrated images

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

Change #1237939 had a related patch set uploaded (by Paladox; author: SarthakSingh2904):

[mediawiki/extensions/ImageRating@REL1_45] Fix Special:ImageRating to show unrated images

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

Change #1237939 merged by jenkins-bot:

[mediawiki/extensions/ImageRating@REL1_45] Fix Special:ImageRating to show unrated images

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