diff --git a/kitsune/customercare/forms.py b/kitsune/customercare/forms.py index dfce67e6b5f..85354290509 100644 --- a/kitsune/customercare/forms.py +++ b/kitsune/customercare/forms.py @@ -68,9 +68,10 @@ def __init__(self, *args, product, user=None, **kwargs): else: self.fields["email"].initial = user.email self.label_suffix = "" + if product.slug not in PRODUCTS_WITH_OS: del self.fields["os"] - def send(self, user, product_config): + def send(self, user): client = ZendeskClient() - return client.create_ticket(user, self.cleaned_data, product_config) + return client.create_ticket(user, self.cleaned_data) diff --git a/kitsune/customercare/zendesk.py b/kitsune/customercare/zendesk.py index 9601b484aa3..0d0c4fbc0a6 100644 --- a/kitsune/customercare/zendesk.py +++ b/kitsune/customercare/zendesk.py @@ -1,12 +1,9 @@ from django.conf import settings -from django.utils.translation import gettext_lazy as _lazy from zenpy import Zenpy from zenpy.lib.api_objects import Identity as ZendeskIdentity from zenpy.lib.api_objects import Ticket from zenpy.lib.api_objects import User as ZendeskUser -NO_RESPONSE = _lazy("No response provided.") - class ZendeskClient(object): """Client to connect to Zendesk API.""" @@ -79,7 +76,7 @@ def update_primary_email(self, zendesk_user_id, email): user=zendesk_user_id, identity=ZendeskIdentity(id=identity_id, value=email) ) - def create_ticket(self, user, ticket_fields, product_config): + def create_ticket(self, user, ticket_fields): """Create a ticket in Zendesk.""" custom_fields = [ {"id": settings.ZENDESK_PRODUCT_FIELD_ID, "value": ticket_fields.get("product")}, @@ -104,8 +101,8 @@ def create_ticket(self, user, ticket_fields, product_config): ] ) ticket = Ticket( - subject=ticket_fields.get("subject") or f"{product_config['name']} support", - comment={"body": ticket_fields.get("description") or NO_RESPONSE}, + subject=ticket_fields.get("subject") or ticket_fields.get("category"), + comment={"body": ticket_fields.get("description") or ticket_fields.get("category")}, ticket_form_id=settings.ZENDESK_TICKET_FORM_ID, custom_fields=custom_fields, ) diff --git a/kitsune/questions/views.py b/kitsune/questions/views.py index 659863fb910..f659d1d63b5 100644 --- a/kitsune/questions/views.py +++ b/kitsune/questions/views.py @@ -560,7 +560,7 @@ def aaq(request, product_key=None, category_key=None, step=1, is_loginless=False if zendesk_form.is_valid() and not is_ratelimited(request, "loginless", "3/d"): try: - zendesk_form.send(request.user, product_config) + zendesk_form.send(request.user) email = zendesk_form.cleaned_data["email"] messages.add_message( request,