Closed thomasplevy closed 2 years ago
@eri-trabiccolo I've already confirmed this and written a quick fix locally so I'm not blocked but this could be cleaned up sooner than later for release with the other access plan bug you already fixed
@thomasplevy
availability
schema property, but the model's has_availability_restrictions()
relies on that. So I'm going to switch the availability
based on whether availability_restriction
property has been provided.availaibilty_restrictions
props for memberships.Agreed?
I think this makes sense @eri-trabiccolo. The property barely seems necessary today and really seems unnecessary with what I'm building right now. So keeping it as you have for backwards compatibility purposes but not requiring users to have to actually update it via REST feels good.
I don't want to take the time to properly deprecated it right now but we can phase out it's usefulness and maybe remove it officially alongside the release of the react stuff I'm working on
Reproduction Steps
availability_restrictions
property.GET /access-plans/$id
request or aGET /access-plans
(list) request that would return the access plan with restrictionsExpected Behavior
availability_restrictions
property contains an array of WP_Post IDsActual Behavior
Looks like the error is here:
https://github.com/gocodebox/lifterlms-rest/blob/a3a644da3edd10d923e967fe0b6244606d3d1f5f/includes/server/class-llms-rest-access-plans-controller.php#L278
the empty array is in the wrong position on the ternary
Also after the above is corrected, ideally an array of ints should be returned instead of an array of strings