PR changes

This commit is contained in:
Adrià Casajús 2022-02-14 11:19:03 +01:00
parent 700856053a
commit 305ce38379
No known key found for this signature in database
GPG Key ID: F0033226A5AFC9B9
2 changed files with 7 additions and 8 deletions

View File

@ -10,7 +10,6 @@ from werkzeug.datastructures import FileStorage
from app.dashboard.base import dashboard_bp
from app.extensions import limiter
from app.log import LOG
from app.models import Mailbox
from app.config import ZENDESK_HOST, ZENDESK_API_TOKEN
VALID_MIME_TYPES = ["text/plain", "message/rfc822"]
@ -28,9 +27,9 @@ def show_support_dialog():
def check_zendesk_response_status(response_code: int) -> bool:
if response_code != 201:
if response_code in (401, 422):
LOG.error("Could not authenticate")
LOG.e("Could not authenticate")
else:
LOG.error("Problem with the request. Status {}".format(response_code))
LOG.e("Problem with the request. Status {}".format(response_code))
return False
return True
@ -79,7 +78,7 @@ def create_zendesk_request(email: str, content: str, files: [FileStorage]) -> bo
response = requests.post(url, data=json.dumps(data), headers=headers, auth=auth)
if not check_zendesk_response_status(response.status_code):
return False
LOG.debug("Ticket created")
LOG.d("Ticket created")
return True

View File

@ -50,16 +50,16 @@
<div class="card">
<div class="card-body">
<div class="card-title mb-3">Report a problem</div>
<div class="card-subtitle mt-2 mb-2 pl-3 border-left border-warning" style="border-left-width: 5px !important;" >
<div class="alert alert-info">
If an email cannot be delivered to your mailbox, please check <a href="/dashboard/notifications">your notifications</a> for error messages
</div>
<div class="mt-2">
<div class="alert alert-warning">
A support ticket will be created in Zendesk. Please do not include any sensitive information in the ticket.
</div>
<form id="supportZendeskForm" method="post" enctype="multipart/form-data">
<div class="mt-4 mb-5">
<label for="issueDescription" class="form-label">What happened?</label>
<textarea class="form-control" name="ticket_content" id="issueDescription" rows="3" placeholder="Please provide as much information as possible. For example which alias(es), mailbox(es) ar affected, if this is a persistent issue...">{{- ticket_content or '' -}}</textarea>
<textarea class="form-control" required name="ticket_content" id="issueDescription" rows="3" placeholder="Please provide as much information as possible. For example which alias(es), mailbox(es) ar affected, if this is a persistent issue...">{{- ticket_content or '' -}}</textarea>
</div>
<div class="mt-5 font-weight-bold">
Attach files to support request
@ -76,7 +76,7 @@
Conversations related to this ticket will be sent to this address. Feel free to use an alias here.
</div>
<div class="input-group mb-3" id="alias-group">
<input type="text" class="form-control" placeholder="Email" name="ticket_email" v-model='ticket_email' aria-label="Email to send responses to" aria-describedby="button-addon2">
<input type="text" required class="form-control" placeholder="Email" name="ticket_email" v-model='ticket_email' aria-label="Email to send responses to" aria-describedby="button-addon2">
<div class="input-group-append">
<button class="btn btn-outline-primary" type="button" @click="generateRandomAlias" id="button-addon2">Generate a random alias</button>
</div>