Closed markspolakovs closed 3 years ago
Tested working on staging with the latest commit. To try it yourself, go to https://ury.org.uk/api-staging/v2/podcast/podcastsattachedtouser?api_key=YOUR_API_KEY&user=AN_USER_ID
Wait, hang on, it's misbehaving.
Right, that should work.
r?'ing @mstratford as this now touches some MyRadio internals and I'd appreciate an extra pair of eyes
I've never been 100% sure how the mixins work, I'd appreciate finding out why the mixins come into these changes?
@mstratford Mixins are only ever used in ServiceAPI::toDataSource()
to customise what fields you want (e.g. compare https://ury.org.uk/api/v2/user/currentuser and https://ury.org.uk/api/v2/user/currentuser?mixins=training,shows,personal_data,all_officerships).
They shouldn't be finding their way into any other methods, yet when I used this branch as of the commit-before-last with a mixin (e.g. https://ury.org.uk/api-staging/v2/podcast/podcastsattachedtouser?api_key=YOUR_API_KEY&user=AN_USER_ID&mixins=show) I got an error about the $user
parameter - sticking in a var_dump revealed that it was passing in the value of the mixins
field into the $user
parameter. The simplest fix was to filter it out like we already do with api_key
.
The API thinks a MyRadio_User param is an int. It is not.