Page MenuHomePhabricator

[M] Image Recommendations - Send feedback when rejecting or accepting images.
Closed, ResolvedPublic

Description

On Image recommendation, when an image is rejected or accepted, we must feed this info so the image is not shown for other users.

We need to perform a PUT call to:

/w/rest.php/growthexperiments/v0/suggestions/addimage/feedback/{title}

The body of the call:

token: String (CSRF Token)
editRevId: Int 
filename: String 
accepted: Boolean 
reasons: [String]
caption: String?
sectionTitle: String?
sectionNumber: Int?

These are the reason codes expected by the API - they should match the survey values:

"notrelevant", "noinfo", "offensive", "lowquality", "unfamiliar", "other"

The analytics portion of this work will be done in another ticket.

Event Timeline

Tsevener renamed this task from Image Recommendations - Send feedback when rejecting or accepting images. to [M] Image Recommendations - Send feedback when rejecting or accepting images..Mar 26 2024, 5:25 PM

@Dbrant Hey Dmitry – wanted to confirm some things that came up in engineering sync to be sure we have parity with Android:

  • Is editRevId intended to be: 0 if the user is rejecting the recommendation, and the actual post-publishing revision ID of the edit made if the recommendation is accepted?
  • Are you all allowing any user submitted custom text entry reasons for the "Other" selection? From looking at the designs here, it appears you aren't but wanted to confirm in case I was missing something.
  • We're primarily concerned with lead images for now. What're you all using for sectionTitle and sectionNumber?

@Dbrant Hey Dmitry – wanted to confirm some things that came up in engineering sync to be sure we have parity with Android:

Good questions; there are a few quirks in this API that I'll mention:

  • Is editRevId intended to be: 0 if the user is rejecting the recommendation, and the actual post-publishing revision ID of the edit made if the recommendation is accepted?

Yes, when accepting the recommendation the editRevId must be the new revision ID, but when rejecting the recommendation the editRevId field should actually be omitted from the structure.

  • Are you all allowing any user submitted custom text entry reasons for the "Other" selection? From looking at the designs here, it appears you aren't but wanted to confirm in case I was missing something.

Correct, this API only supports this list of rejection reasons. (Note: when accepting a recommendation, you still need to provide an empty array of reasons)

  • We're primarily concerned with lead images for now. What're you all using for sectionTitle and sectionNumber?

Both of these should be null, but due to another quirk, these are "required" parameters, so you must still send them, even though they're null.

One more quirk is that the caption field must always be non-empty, even if the user didn't enter a caption. (we just feed it the same text as the filename in that case.)

Here is a complete example structure for an image I just added:

{
  "token":"redacted",
  "editRevId":1215858385,
  "filename":"Calocidaris_micans.jpg",
  "accepted":true,
  "reasons":[],
  "caption":"Calocidaris micans",
  "sectionTitle":null,
  "sectionNumber":null
}

and a structure for an image I rejected:

{
  "token":"redacted",
  "filename":"Warsaw_during_WWII_-_Rondo_Dmowskiego.jpg",
  "accepted":false,
  "reasons":["noinfo"],
  "caption":"Warsaw_during_WWII_-_Rondo_Dmowskiego.jpg",
  "sectionTitle":null,
  "sectionNumber":null
}

@Dbrant Awesome – thank you for confirming the details and for the example JSON!

Holding on moving this ticket further until the calls are connected in T358923.

Confirmed that the app is sending these calls and receiving a 200 (success) response. That is the most testing we can do here. Moving into Ready for Release.

HNordeenWMF claimed this task.
HNordeenWMF changed the task status from Unknown Status to Resolved.Tue, May 7, 10:18 PM