From 20cd08fe28afa47967a75da0ecf51246e1e177e5 Mon Sep 17 00:00:00 2001 From: Georg Lehner Date: Mon, 10 Jun 2024 12:47:13 +0200 Subject: [PATCH] Do not show attachments in public tickets if not enabled, fix attachment upload if enabled Attachments in followups were still shown (if they existed) even if HELPDESK_ENABLE_ATTACHMENT was set to False. If attachments were enabled it was not possible to upload them because the JavaScript code for uploading attachments to public was not loaded in the template. --- helpdesk/templates/helpdesk/public_base.html | 1 + .../helpdesk/public_view_ticket.html | 66 +++++++++++++++---- 2 files changed, 56 insertions(+), 11 deletions(-) diff --git a/helpdesk/templates/helpdesk/public_base.html b/helpdesk/templates/helpdesk/public_base.html index ca0b74e1..22f256dc 100644 --- a/helpdesk/templates/helpdesk/public_base.html +++ b/helpdesk/templates/helpdesk/public_base.html @@ -9,6 +9,7 @@ {% include 'helpdesk/base-head.html' %} {% block helpdesk_head %}{% endblock %} + {% include 'helpdesk/base_js.html' %} diff --git a/helpdesk/templates/helpdesk/public_view_ticket.html b/helpdesk/templates/helpdesk/public_view_ticket.html index ee36e304..4c5a736e 100644 --- a/helpdesk/templates/helpdesk/public_view_ticket.html +++ b/helpdesk/templates/helpdesk/public_view_ticket.html @@ -75,16 +75,19 @@ {% for followup in ticket.followup_set.public_followups %}

{{ followup.title }}

-{{ followup.comment|force_escape|urlizetrunc:50|num_to_link|linebreaksbr }} -{% if followup.ticketchange_set.all %}
    -{% for change in followup.ticketchange_set.all %} -
  • {% blocktrans with change.field as field and change.old_value as old_value and change.new_value as new_value %}Changed {{ field }} from {{ old_value }} to {{ new_value }}.{% endblocktrans %}
  • -{% endfor %} -
{% endif %} -{% for attachment in followup.followupattachment_set.all %}{% if forloop.first %}
    {% endif %} -
  • {{ attachment.filename }} ({{ attachment.mime_type }}, {{ attachment.size|filesizeformat }})
  • -{% if forloop.last %}
{% endif %} -{% endfor %} + {{ followup.comment|force_escape|urlizetrunc:50|num_to_link|linebreaksbr }} + {% if followup.ticketchange_set.all %}
    + {% for change in followup.ticketchange_set.all %} +
  • {% blocktrans with change.field as field and change.old_value as old_value and change.new_value as new_value %}Changed {{ field }} from {{ old_value }} to {{ new_value }}.{% endblocktrans %}
  • + {% endfor %} +
{% endif %} + + {% if helpdesk_settings.HELPDESK_ENABLE_ATTACHMENTS %} + {% for attachment in followup.followupattachment_set.all %}{% if forloop.first %}
    {% endif %} +
  • {{ attachment.filename }} ({{ attachment.mime_type }}, {{ attachment.size|filesizeformat }})
  • + {% if forloop.last %}
{% endif %} + {% endfor %} + {% endif %}
{% endfor %} {% endif %} @@ -133,6 +136,7 @@
+
 {% trans 'No files selected.' %}
@@ -146,7 +150,47 @@ -{% csrf_token %} +{% csrf_token %} + +{% if helpdesk_settings.HELPDESK_ENABLE_ATTACHMENTS %} + +{% endif %} {% endblock %}