diff --git a/helpdesk/email.py b/helpdesk/email.py index 2e076585..483d96b1 100644 --- a/helpdesk/email.py +++ b/helpdesk/email.py @@ -471,9 +471,12 @@ def object_from_message(message, queue, logger): if part.get_content_maintype() == 'text' and name is None: if part.get_content_subtype() == 'plain': - body = EmailReplyParser.parse_reply( - decodeUnknown(part.get_content_charset(), part.get_payload(decode=True)) - ) + body = part.get_payload(decode=True) + # https://github.com/django-helpdesk/django-helpdesk/issues/732 + if part['Content-Transfer-Encoding'] == '8bit' and part.get_content_charset() == 'utf-8': + body = body.decode('unicode_escape') + body = decodeUnknown(part.get_content_charset(), body) + body = EmailReplyParser.parse_reply(body) # workaround to get unicode text out rather than escaped text try: body = body.encode('ascii').decode('unicode_escape') @@ -481,9 +484,15 @@ def object_from_message(message, queue, logger): body.encode('utf-8') logger.debug("Discovered plain text MIME part") else: - payload = encoding.smart_bytes(part.get_payload(decode=True)) + payload = """ + +
+ + +%s +""" % encoding.smart_text(part.get_payload(decode=True)) files.append( - SimpleUploadedFile(_("email_html_body.html"), payload, 'text/html') + SimpleUploadedFile(_("email_html_body.html"), payload.encode("utf-8"), 'text/html') ) logger.debug("Discovered HTML MIME part") else: diff --git a/helpdesk/models.py b/helpdesk/models.py index 73b29f06..6264cf84 100644 --- a/helpdesk/models.py +++ b/helpdesk/models.py @@ -748,6 +748,10 @@ class Ticket(models.Model): def get_markdown(self): return get_markdown(self.description) + @property + def get_resolution_markdown(self): + return get_markdown(self.resolution) + class FollowUpManager(models.Manager): diff --git a/helpdesk/serializers.py b/helpdesk/serializers.py index abd95581..bacd96cc 100644 --- a/helpdesk/serializers.py +++ b/helpdesk/serializers.py @@ -19,6 +19,7 @@ class TicketSerializer(serializers.ModelSerializer): status = serializers.SerializerMethodField() row_class = serializers.SerializerMethodField() time_spent = serializers.SerializerMethodField() + queue = serializers.SerializerMethodField() class Meta: model = Ticket @@ -27,6 +28,9 @@ class TicketSerializer(serializers.ModelSerializer): 'created', 'due_date', 'assigned_to', 'row_class', 'time_spent') + def get_queue(self, obj): + return ({"title": obj.queue.title, "id": obj.queue.id}) + def get_ticket(self, obj): return (str(obj.id) + " " + obj.ticket) diff --git a/helpdesk/static/helpdesk/helpdesk-extend.css b/helpdesk/static/helpdesk/helpdesk-extend.css index 4fa6c7dd..8b2e5c69 100644 --- a/helpdesk/static/helpdesk/helpdesk-extend.css +++ b/helpdesk/static/helpdesk/helpdesk-extend.css @@ -87,3 +87,11 @@ pre { padding: 1em; border: 1pt solid white; } + +table .tickettitle { + max-width: 250px; + font-weight: bold; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} diff --git a/helpdesk/templates/helpdesk/include/tickets.html b/helpdesk/templates/helpdesk/include/tickets.html index 745b246b..bc0effd0 100644 --- a/helpdesk/templates/helpdesk/include/tickets.html +++ b/helpdesk/templates/helpdesk/include/tickets.html @@ -8,12 +8,11 @@# | -{% trans "Pr" %} | -{% trans "Title" %} | +{% trans "Ticket" %} | +{% trans "Priority" %} | {% trans "Queue" %} | {% trans "Status" %} | {% trans "Last Update" %} | @@ -22,9 +21,8 @@||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
{{ ticket.ticket }} | +{{ ticket.id }}. {{ ticket.title }} | {{ ticket.priority }} | -{{ ticket.title }} | {{ ticket.queue }} | {{ ticket.get_status }} | {{ ticket.modified|naturaltime }} | diff --git a/helpdesk/templates/helpdesk/include/unassigned.html b/helpdesk/templates/helpdesk/include/unassigned.html index e13bcb79..9632ab36 100644 --- a/helpdesk/templates/helpdesk/include/unassigned.html +++ b/helpdesk/templates/helpdesk/include/unassigned.html @@ -8,28 +8,26 @@
# | -{% trans "Pr" %} | -{% trans "Title" %} | +{% trans "Ticket" %} | +{% trans "Prority" %} | {% trans "Queue" %} | -{% trans "Status" %} | -+ | {% trans "Created" %} | +{% trans "Actions" %} | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
{{ ticket.ticket }} | +{{ ticket.id }}. {{ ticket.title }} | {{ ticket.priority }} | -{{ ticket.title }} | {{ ticket.queue }} | {{ ticket.created|naturaltime }} | -- | - + | + + | {% trans "Resolution" %}{% ifequal ticket.get_status_display "Resolved" %} {% endifequal %} | ||||||||
{{ ticket.resolution|force_escape|urlizetrunc:50|linebreaksbr }} | +{{ ticket.get_resolution_markdown|urlizetrunc:50|linebreaksbr }} | |||||||||||||||
{% trans "Due Date" %} | diff --git a/helpdesk/templates/helpdesk/ticket_list.html b/helpdesk/templates/helpdesk/ticket_list.html index 46db483e..2398e6c9 100644 --- a/helpdesk/templates/helpdesk/ticket_list.html +++ b/helpdesk/templates/helpdesk/ticket_list.html @@ -41,7 +41,7 @@
# | - | {% trans "Pr" %} | -{% trans "Title" %} | +{% trans "Ticket" %} | +{% trans "Prority" %} | {% trans "Queue" %} | {% trans "Status" %} | {% trans "Created" %} | @@ -301,18 +307,6 @@ }, "columns": [ - {"data": "ticket", - "render": function (data, type, row, meta) - { - var id = data.split(" ")[0]; - var name = data.split(" ")[1]; - if (type === 'display') - { - data = '' + name + ''; - } - return data - } - }, {"data": "id", "orderable": false, "render": function(data, type, row, meta) @@ -324,22 +318,49 @@ return data } }, - {"data": "priority"}, - {"data": "title", + {"data": "ticket", "render": function (data, type, row, meta) { - if (type === 'display') - { - data = '' + data + ''; - } - return data + var id = data.split(" ")[0]; + var name = data.split(" ")[1]; + if (type === 'display') + { + data = ''; + } + return data } }, - {"data": "queue"}, + {"data": "priority", + "render": function (data, type, row, meta) { + var priority = "success"; + if (data == 4 ) { + priority = "warning"; + } else if (data == 5) { + priority = "danger"; + } + return '
---|---|---|---|---|---|---|---|---|
{{ ticket.ticket }} | - | {{ ticket.priority }} | +{{ ticket.priority }}||||| | {{ ticket.title }} | {{ ticket.queue }} | {{ ticket.get_status }} | diff --git a/helpdesk/tests/test_get_email.py b/helpdesk/tests/test_get_email.py index 76184ec1..50a5f1e5 100644 --- a/helpdesk/tests/test_get_email.py +++ b/helpdesk/tests/test_get_email.py @@ -53,7 +53,7 @@ class GetEmailCommonTests(TestCase): with open(os.path.join(THIS_DIR, "test_files/blank-body-with-attachment.eml")) as fd: test_email = fd.read() ticket = helpdesk.email.object_from_message(test_email, self.queue_public, self.logger) - self.assertEqual(ticket.title, "FollowUpAttachment without body") + self.assertEqual(ticket.title, "Attachment without body") self.assertEqual(ticket.description, "") def test_email_with_quoted_printable_body(self): @@ -71,7 +71,7 @@ class GetEmailCommonTests(TestCase): attachments = FollowUpAttachment.objects.filter(followup=followup) self.assertEqual(len(attachments), 1) attachment = attachments[0] - self.assertEqual(attachment.file.read().decode("utf-8"), '