Merge pull request #23757 from edx/fsheets/contact-us-hackathon-2

Update wording for clarity and bug fix for API expectations
This commit is contained in:
Farhanah Sheets
2020-04-21 10:49:44 -04:00
committed by GitHub
4 changed files with 19 additions and 16 deletions

View File

@@ -34,10 +34,10 @@ function LoggedInUser({ userInformation, setErrorState, zendeskApiHost, submitFo
</div>);
}
let subjectElement;
subjectElement = (<div>
<label htmlFor="subject">{gettext('Subject')}</label>
<select className="form-control select-subject" id="subject">
let topicElement;
topicElement = (<div>
<label htmlFor="topic">{gettext('Topic')}</label>
<select className="form-control select-subject" id="topic">
<option value="">--------</option>
<option value="Account Settings">{gettext('Account Settings')}</option>
<option value="Billing/Payment Options">{gettext('Billing/Payment Options')}</option>
@@ -86,7 +86,7 @@ function LoggedInUser({ userInformation, setErrorState, zendeskApiHost, submitFo
<div className="row">
<div className="col-sm-12">
<div className="form-group">
{subjectElement}
{topicElement}
</div>
</div>
</div>

View File

@@ -37,7 +37,7 @@ class RenderForm extends React.Component {
$userInfo = $('.user-info'),
request = new XMLHttpRequest(),
$course = $('#course'),
$subject = $('#subject'),
$topic = $('#topic'),
data = {
comment: {
body: $('#message').val(),
@@ -67,16 +67,16 @@ class RenderForm extends React.Component {
value: course,
}];
let subject;
subject = $subject.find(':selected').val();
if (!subject) {
subject = $subject.val();
let topic;
topic = $topic.find(':selected').val();
if (!topic) {
topic = $topic.val();
}
if (!subject) {
$('#subject').closest('.form-group').addClass('has-error');
errors.push(gettext('Select a subject for your support request.'));
if (!topic) {
$('#topic').closest('.form-group').addClass('has-error');
errors.push(gettext('Select a topic for your support request.'));
}
data.subject = subject;
data.subject = topic; // Zendesk API requires 'subject'
if (this.validateData(data, errors)) {
request.open('POST', url, true);

View File

@@ -28,7 +28,7 @@ function Success({ platformName, homepageUrl, dashboardUrl, isLoggedIn }) {
<div className="row">
<div className="col-sm-12">
<p>{gettext('Thank you for submitting a request!')}</p>
<p>{gettext('Thank you for submitting a request! We appreciate your patience while we work to review your request.')}</p>
</div>
</div>

View File

@@ -1,6 +1,7 @@
"""
Define request handlers used by the zendesk_proxy djangoapp
"""
import logging
from rest_framework import status
from rest_framework.parsers import JSONParser
@@ -10,6 +11,7 @@ from rest_framework.views import APIView
from openedx.core.djangoapps.zendesk_proxy.utils import create_zendesk_ticket
logger = logging.getLogger(__name__)
REQUESTS_PER_HOUR = 50
@@ -62,7 +64,8 @@ class ZendeskPassthroughView(APIView):
custom_fields=request.data['custom_fields'],
tags=request.data['tags']
)
except KeyError:
except KeyError as key:
logger.error('Zendesk Proxy Bad Request KeyError: %s', key)
return Response(status=status.HTTP_400_BAD_REQUEST)
return Response(