From b7e96cf7843374551f13974b3cc792757993b774 Mon Sep 17 00:00:00 2001 From: Alice Date: Mon, 16 Jan 2017 03:10:21 +0000 Subject: [PATCH] Allow empty message field to close a ticket --- templates/tickets/view.html | 9 ++++++++- tickets/views.py | 9 +++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/templates/tickets/view.html b/templates/tickets/view.html index 58052de..7f96df2 100644 --- a/templates/tickets/view.html +++ b/templates/tickets/view.html @@ -35,7 +35,14 @@
{% csrf_token %} - {{ form }} + + + + + {% if staff_reply %} + + + {% endif %} {% if ticket.is_open %} diff --git a/tickets/views.py b/tickets/views.py index bb89026..9f12990 100644 --- a/tickets/views.py +++ b/tickets/views.py @@ -107,15 +107,11 @@ def view(request, id): messages = ticket.message_set.filter(staff_only=False) if request.method != 'POST': - if request.user.is_staff: - form = StaffReplyForm() - else: - form = ReplyForm() - ctx = dict( + staff_reply=request.user.has_perm('tickets.post_private_message'), ticket=ticket, ticket_messages=messages, - form=form, + form=ReplyForm(), title=_("Ticket:") + " " + ticket.subject, ) ctx.update(common_context(request)) @@ -142,6 +138,7 @@ def view(request, id): if not form.is_valid(): ctx = dict( + staff_reply=request.user.has_perm('tickets.post_private_message'), ticket=ticket, ticket_messages=messages, form=form,