Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions kitsune/questions/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,8 @@ def aaq_step3(request, product_slug):
request.headers.get("hx-trigger-name") == "category"
):
topic_id = request.GET.get("category")
if not topic_id:
return HttpResponse(status=204)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We are getting a validation error that instead of the topic id which we need to retrieve it form the db (and it's an integer) we are getting an empty string. The proposed response will silence the error but it's not fixing the underlying problem

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey @akatsoulas, could you please elaborate on what underlying problem you meant above? Did you mean that we need to validate that topic_id is an integer here, or that we shouldn't send a hx-request at all when the category is empty?

product = get_object_or_404(Product.active, slug=product_slug)
topic = get_object_or_404(Topic.active.filter(products=product, in_aaq=True), pk=topic_id)
response = HttpResponse(status=204)
Expand Down