Skip to content

Commit

Permalink
🪲 Always return empty JSON object on successful response, fixes #6160 (
Browse files Browse the repository at this point in the history
…#6161)

Fixes #6160, and potentially similar bugs as well. 

⚠️ I changes all occurrences of `'', 200` in `make_response`, but I only tested that `join_class` works as intended and #6160 is fixed. I don't know enough about the application to test the other occurrences effectively. This should be tested for the other functionality as well by a maintainer.
  • Loading branch information
confiks authored Feb 6, 2025
1 parent 4f74f2f commit 126b753
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions website/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def mark_as_teacher(self, username_teacher):

update_is_teacher(self.db, teacher, is_teacher_value)

return make_response('', 200)
return make_response({}, 200)

@route("/mark-super-teacher/<username_teacher>", methods=["POST"])
@requires_admin
Expand Down Expand Up @@ -231,7 +231,7 @@ def change_user_email(self, user):
)
except BaseException:
return make_response(gettext("mail_error_change_processed"), 400)
return make_response('', 200)
return make_response({}, 200)

@route("/getUserTags", methods=["POST"])
@requires_admin
Expand Down
2 changes: 1 addition & 1 deletion website/auth_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ def store_new_account(self, account, email):
)
except BaseException:
return user, make_response({gettext("mail_error_change_processed")}, 400)
resp = make_response('', 200)
resp = make_response({}, 200)
return user, resp

@route('/public_profile', methods=['POST'])
Expand Down
6 changes: 3 additions & 3 deletions website/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def join_class(self):
# Also remove the pending message in this case
session["messages"] = session["messages"] - 1 if session["messages"] else 0

return make_response('', 200)
return make_response({}, 200)

@route("/<class_id>/student/<student_id>", methods=["DELETE"])
@requires_login
Expand All @@ -187,7 +187,7 @@ def leave_class(self, user, class_id, student_id):

self.db.remove_student_from_class(Class["id"], student_id)
refresh_current_user_from_db()
return make_response('', 200)
return make_response({}, 200)

@route("/<class_id>/second-teacher/<second_teacher>", methods=["DELETE"])
@requires_login
Expand All @@ -199,7 +199,7 @@ def remove_second_teacher(self, user, class_id, second_teacher):
self.db.remove_second_teacher_from_class(Class, second_teacher)

refresh_current_user_from_db()
return make_response('', 200)
return make_response({}, 200)


class MiscClassPages(WebsiteModule):
Expand Down
2 changes: 1 addition & 1 deletion website/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,4 @@ def delete_tag(self, user, tag):
for adventure in db_tag['tagged_in']:
self.db.delete_tag_from_adventure(tag, adventure['id'])

return make_response('', 200)
return make_response({}, 200)

0 comments on commit 126b753

Please sign in to comment.