-
-
Notifications
You must be signed in to change notification settings - Fork 766
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Image recommendations - Add feedback API calls #4796
Conversation
- Adds ability to call into new backend (MediaWiki Rest) - Adds ability to make PUT requests to new backend
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice – one note below.
WMF Framework/MediaWikiFetcher.swift
Outdated
var tokenizedParams = request.parameters ?? [:] | ||
tokenizedParams["token"] = token.value | ||
|
||
self?.performPut(url: url, parameters: tokenizedParams, completion: completion) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the event that self is nil here, this call could leave the completion block uncalled. Would it make sense to call the completion block with some kind of failure here in the case that self is nil in order to prevent the caller from waiting on a completion that never occurs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@staykids Good catch - this is done!
Phabricator:
https://phabricator.wikimedia.org/T360574
Notes
This PR adds the ability to send feedback API calls when approving or rejecting an image suggestion. This is the first WKData API call against the MediaWiki Rest API. I wasn't able to lean on some of the existing calls in MediaWikiFetcher, so I had to extend it a bit to support PUT and these new url styles.
There's not really an easy way to test this without the connections to the survey and edit summary views, so we can skip testing until that connection is made. I tested these calls by updating this method in ExploreViewController, tapping Yes to the toolbar button and watching the http traffic: