Skip to content

Commit

Permalink
Handle request data as object not as string
Browse files Browse the repository at this point in the history
  • Loading branch information
razzeee committed Jun 22, 2024
1 parent dc6bb6f commit 3de47a7
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions backend/app/moderation.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ def submit_review_request(
"requests": [
{
"requestType": request.request_type,
"requestData": json.loads(request.request_data),
"requestData": createRequestData(request.request_data),
"isNewSubmission": request.is_new_submission,
}
for request in requests
Expand Down Expand Up @@ -572,7 +572,7 @@ def submit_review(
"buildLogUrl": request.build_log_url,
"request": {
"requestType": request.request_type,
"requestData": json.loads(request.request_data),
"requestData": createRequestData(request.request_data),
"isNewSubmission": request.is_new_submission,
},
"references": f"{request.appid}/{request.build_id}/held",
Expand All @@ -587,6 +587,17 @@ def submit_review(
return ReviewResponse(github_issue_url=issue.url) if issue else None


def createRequestData(request_data: str):
requestDataLoaded = json.loads(request_data)

return RequestData(
current_values=json.loads(
requestDataLoaded["current_values"].replace("'", '"')
),
keys=json.loads(requestDataLoaded["keys"].replace("'", '"')),
)


def register_to_app(app: FastAPI):
"""
Register the login and authentication flows with the FastAPI application
Expand Down

0 comments on commit 3de47a7

Please sign in to comment.