Page MenuHomePhabricator

Pageimages should return both free and non-free images with 'free-ness' denoted as a property
Closed, ResolvedPublic5 Estimated Story Points

Description

Background

The current API change that prevents returning images that are non-free was the easiest and most pragmatic solution to an immediate concern. However, this blanket solution prevents the community from creating or applying policy with nuance, because it mandates a specific policy across all use cases, projects, and 3rd party re-use clients. This is already an issue, as the english language community decided that non-free images were allowable on hovercards: https://en.wikipedia.org/wiki/Wikipedia_talk:Non-free_content/Archive_65#Hovercards

When we move hovercards to restbase (T123445), the image returned there will have to comply with relevant policy.

It is time to revisit this issue and apply a more flexible approach.

Story

As an engineer implementing a feature that pulls images from Wikipedia or Commons, I require the ability to use either non-free images or only free images, as determined by my needs and how they correspond to community policy.

More specifically, the pageimages API should return images whose license is based upon a parameter (default free-only).

Acceptance Criteria

  • The API should return free images for any requests that do not specify a free-ness/license parameter (IOW, backwards-compatibility)
  • The API should return non-free images if specified by new parameter
  • Specific testing should be done to ensure current requests to the API remain operational (though this should be satisfied by the first AC)

Test plan

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
Restricted Application added a subscriber: Aklapper. ยท View Herald TranscriptMar 28 2016, 9:30 PM
โ€ข JKatzWMF renamed this task from Have pageimages return whether or not image is free to Pageimages returns both free and non-free images with 'free-ness' denoted as a property.May 16 2016, 7:18 PM
โ€ข JKatzWMF updated the task description. (Show Details)
โ€ข jhobs renamed this task from Pageimages returns both free and non-free images with 'free-ness' denoted as a property to Pageimages should return both free and non-free images with 'free-ness' denoted as a property.Oct 13 2016, 8:38 PM

To make sure I'm understanding the descriptions correctly:
There are two proposed solutions:

  1. When I request a PageImage, I get one free and one non-free image (if both exist)
  2. When I request a PageImage, I specifically request either a free or non-free (free by default)

Is that correct? If so, my guess would be that option 2 would be the more likely use case.

ovasileva raised the priority of this task from Medium to High.Nov 1 2016, 2:43 PM

For existing consumers of the API, will it "just work" without having to change anything in calling the API or inspecting the JSON object?

We decided to proceed with option 2 in T131105#2714458. This would mean that getting a free and non-free image would require two requests. I'll be updating the description to reflect the decision shortly.

For existing consumers of the API, will it "just work" without having to change anything in calling the API or inspecting the JSON object?

This should now be answered in the task description (the answer is "yes").

The reasonable approach is to have 'free' and 'any' options, where a call with 'free' (the default) would return the best free image and a call with 'any' would return the best image (which might or might not be the same). There is no reason anyone would ever want a non-free image specifically.

Change 320703 had a related patch set uploaded (by Bmansurov):
WIP: Allow querying non-free images too

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

Change 321952 had a related patch set uploaded (by Bmansurov):
Add phpunit tests

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

Change 320703 merged by jenkins-bot:
Allow querying non-free images too

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

Testing on iPad Air 2 (iOS 10.2); I will test on other devices later however a few issues happened that I wanted to share first.

Search for "Star Trek test" and verify there is no page image.
There is a page image.

T131105 Star Trek test.PNG (2ร—1 px, 272 KB)

Visit (above link) and run query, which requests an image that can be free. Verify that alongside pageimage Star Trek is the logo not Star Wars.
I wasn't sure if I was running the query correctly, I had simply tapped the Make request button alongside the already filled out info; here is a screencap of the result.

T131105 Run Query Star Trek logo.PNG (2ร—1 px, 187 KB)

Visit (above link) and run the query. Verify that no page image is provided in the response.
I wasn't sure if I was running the query correctly, I had simply tapped the Make request button alongside the already filled out info; here is a screencap of the result.

T131105 Run Query no page images.PNG (2ร—1 px, 212 KB)

Testing on iPad Air 2 (iOS 10.2). The Star Trek Test now works as expected:

T131105_Star_Trek_test_fixed.PNG (2ร—1 px, 130 KB)
For the last two steps in the Test Plan though the results were the same as before, I'm not sure if I did them correctly and want to confirm that I do before testing on other devices.

Visit (above link) and run query, which requests an image that can be free. Verify that alongside page image Star Trek is the logo not Star Wars.
I wasn't sure if I was running the query correctly, I had simply tapped the Make request button alongside the already filled out info; here is a screencap of the result.

T131105_Run_Query_Star_Trek_logo.PNG (2ร—1 px, 187 KB)

Visit (above link) and run the query. Verify that no page image is provided in the response.
I wasn't sure if I was running the query correctly, I had simply tapped the Make request button alongside the already filled out info; here is a screencap of the result.

T131105_Run_Query_no_page_images.PNG (2ร—1 px, 212 KB)

Thanks, @Nicholas.tsg. I confirm that the last two steps are working as expected. Here are the screenshots of my test:

Screen Shot 2016-11-29 at 17.14.29.png (1ร—2 px, 423 KB)

Screen Shot 2016-11-29 at 17.14.41.png (1ร—2 px, 361 KB)

just tested it as well - all done!