PR comment fixes

This commit is contained in:
Adrià Casajús 2022-02-11 13:32:31 +01:00
parent 8120128a51
commit 700856053a
No known key found for this signature in database
GPG Key ID: F0033226A5AFC9B9
1 changed files with 5 additions and 5 deletions

View File

@ -27,7 +27,7 @@ def show_support_dialog():
def check_zendesk_response_status(response_code: int) -> bool: def check_zendesk_response_status(response_code: int) -> bool:
if response_code != 201: if response_code != 201:
if response_code in (401 or 422): if response_code in (401, 422):
LOG.error("Could not authenticate") LOG.error("Could not authenticate")
else: else:
LOG.error("Problem with the request. Status {}".format(response_code)) LOG.error("Problem with the request. Status {}".format(response_code))
@ -91,13 +91,13 @@ def create_zendesk_request(email: str, content: str, files: [FileStorage]) -> bo
def process_support_dialog(): def process_support_dialog():
if not ZENDESK_HOST: if not ZENDESK_HOST:
return render_template("dashboard/support_disabled.html") return render_template("dashboard/support_disabled.html")
content = request.form.get("ticket_content") or "" content = request.form.get("ticket_content")
email = request.form.get("ticket_email") or "" email = request.form.get("ticket_email")
if not content: if not content:
flash("Please add a description", "warning") flash("Please add a description", "error")
return render_template("dashboard/support.html", ticket_email=email) return render_template("dashboard/support.html", ticket_email=email)
if not email: if not email:
flash("Please add an email", "warning") flash("Please add an email", "error")
return render_template("dashboard/support.html", ticket_content=content) return render_template("dashboard/support.html", ticket_content=content)
if not create_zendesk_request( if not create_zendesk_request(
email, content, request.files.getlist("ticket_files") email, content, request.files.getlist("ticket_files")