Skip to content
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

Discussion API doesn't process "pinned" field as boolean #837

Closed
jessemcbride opened this issue Jun 1, 2016 · 3 comments
Closed

Discussion API doesn't process "pinned" field as boolean #837

jessemcbride opened this issue Jun 1, 2016 · 3 comments

Comments

@jessemcbride
Copy link

jessemcbride commented Jun 1, 2016

Summary:

I'm developing a Python wrapper for the API and I've noticed that the pinned field doesn't behave as expected when creating or updating a discussion topic. I have to explicitly send pinned as a lowercase "true" in my request, whereas every other endpoint I've covered evaluates to a boolean correctly no matter what the case is.

Steps to reproduce:

  1. Send a POST request to /api/v1/courses/:course_id/discussion_topics containing the data published=True&pinned=True.
  2. Notice that the topic is published successfully, but remains unpinned.

Request:

curl -X POST -H "Authorization: Bearer <snip>" -H "Cache-Control: no-cache" -H "Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW" -F "pinned=True" -F "published=True" "<snip>/api/v1/courses/1195505/discussion_topics"

Response:

{
  "id": 3832190,
  "title": "No Title",
  <snip>
  "published": true,
  <snip>
  "pinned": false,
}

Expected behavior:

process_pin_parameters should operate consistently with the rest of the API. In particular, "True" should be evaluated as true and "False" should be evaluated as false.

Additional notes:

It seems value_to_boolean() could be used as it is in process_published_parameters to solve the problem.

@ccutrer
Copy link
Contributor

ccutrer commented Jun 1, 2016

I've already pushed up a fix internally, and it's been code reviewed, but not QA'd yet. Hopefully that happens in the next day or two, and this will make it into the 6/25 release.

@jessemcbride
Copy link
Author

Sweet! Thanks @ccutrer.

@simonista
Copy link
Contributor

fixed in 036c11c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants