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

🪲 Fix make_response incorrectly sending text instead of JSON #5599

Merged
merged 18 commits into from
Jun 10, 2024

Conversation

jpelay
Copy link
Member

@jpelay jpelay commented Jun 5, 2024

#5558 Introduced an error where some calls where expecting a JSON, and got text instead. I checked the places where this happened and fix the calls.

If I'm missing some, please add them 😄

How to test
Perform the following:

  • Update an adventure
  • Update a class customization
  • Create students account
  • Reset password
  • Reset a student's password
  • Update your public profile

And all of them should show the success modal!

Also:
Fixes #5550

@jpelay jpelay changed the title 🪲 Fix make responses 🪲 Fix make_response incorrectly sending text instead of JSON Jun 5, 2024
@jpelay jpelay requested a review from Annelein June 5, 2024 17:39
@Annelein
Copy link
Collaborator

Annelein commented Jun 6, 2024

We've found another error, I will solve this tomorrow!

@jpelay
Copy link
Member Author

jpelay commented Jun 7, 2024

@Annelein I fixed the achievements issue! Can you check again please?

@Annelein
Copy link
Collaborator

Annelein commented Jun 9, 2024

@jpelay I've changed some 204's to 200's, because the make_response might not have content, but there might be a check for response.achievements on the frontend, which will result in an error if it's a 204.

Only comment left is about response instead of response_body, otherwise I will approve!

**btw I can also add a check in the frontend for response and then make it a 204 instead?

@jpelay
Copy link
Member Author

jpelay commented Jun 10, 2024

@jpelay I've changed some 204's to 200's, because the make_response might not have content, but there might be a check for response.achievements on the frontend, which will result in an error if it's a 204.

Perfect, thanks!

Only comment left is about response instead of response_body, otherwise I will approve!

What's the comment?

if achievement:
utils.add_pending_achievement({"achievement": achievement})
return make_response({"id": Class["id"]}, 200)
response_body = {"id": Class["id"]}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think response_body is better? Just wondering, I'd prefer response because it's shorter :)))

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer response too! But in some functions there's a response variable already set, and I prefer to make a new one.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true! But not for this function right? And what about the others?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, just renamed them :D

Copy link
Contributor

mergify bot commented Jun 10, 2024

Thank you for contributing! Your pull request is now going on the merge train (choo choo! Do not click update from main anymore, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit f24810f into main Jun 10, 2024
12 checks passed
@mergify mergify bot deleted the fix_make_responses branch June 10, 2024 14:56
Copy link
Contributor

mergify bot commented Jun 10, 2024

Thank you for contributing! Your pull request is now going on the merge train (choo choo! Do not click update from main anymore, and be sure to allow changes to be pushed to your fork).

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

Successfully merging this pull request may close these issues.

🪲 Console errors related to user activity
2 participants