mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2024-11-22 07:53:19 +01:00
commit
1b00086d6e
@ -81,6 +81,10 @@ These changes are visible throughout django-helpdesk
|
||||
- **HELPDESK_EMAIL_FALLBACK_LOCALE** Fallback locale for templated emails when queue locale not found
|
||||
|
||||
**Default:** ``HELPDESK_EMAIL_FALLBACK_LOCALE= "en"``
|
||||
|
||||
- **QUEUE_EMAIL_BOX_UPDATE_ONLY** Only process mail with a valid tracking ID; all other mail will be ignored instead of creating a new ticket.
|
||||
|
||||
**Default:** ``False``
|
||||
|
||||
|
||||
Options shown on public pages
|
||||
|
@ -117,7 +117,15 @@ def send_templated_mail(template_name,
|
||||
|
||||
if files:
|
||||
for filename, filefield in files:
|
||||
msg.attach(filename, open(filefield.path).read())
|
||||
mime = mimetypes.guess_type(filename)
|
||||
if mime[0] is not None and mime[0] == "text/plain":
|
||||
with open(filefield.path, 'r') as file:
|
||||
content = file.read()
|
||||
msg.attach(filename, content)
|
||||
else:
|
||||
with open(filefield.path, 'rb') as file:
|
||||
content = file.read()
|
||||
msg.attach(filename, content)
|
||||
|
||||
return msg.send(fail_silently)
|
||||
|
||||
|
@ -51,7 +51,7 @@ HELPDESK_TRANSLATE_TICKET_COMMENTS = getattr(settings,
|
||||
# all default google translate languages will be shown.
|
||||
HELPDESK_TRANSLATE_TICKET_COMMENTS_LANG = getattr(settings,
|
||||
'HELPDESK_TRANSLATE_TICKET_COMMENTS_LANG',
|
||||
["en", "de", "fr", "it", "ru"])
|
||||
["en", "de", "es", "fr", "it", "ru"])
|
||||
|
||||
# show link to 'change password' on 'User Settings' page?
|
||||
HELPDESK_SHOW_CHANGE_PASSWORD = getattr(settings, 'HELPDESK_SHOW_CHANGE_PASSWORD', False)
|
||||
@ -133,6 +133,8 @@ QUEUE_EMAIL_BOX_SSL = getattr(settings, 'QUEUE_EMAIL_BOX_SSL', None)
|
||||
QUEUE_EMAIL_BOX_HOST = getattr(settings, 'QUEUE_EMAIL_BOX_HOST', None)
|
||||
QUEUE_EMAIL_BOX_USER = getattr(settings, 'QUEUE_EMAIL_BOX_USER', None)
|
||||
QUEUE_EMAIL_BOX_PASSWORD = getattr(settings, 'QUEUE_EMAIL_BOX_PASSWORD', None)
|
||||
|
||||
# only process emails with a valid tracking ID? (throws away all other mail)
|
||||
QUEUE_EMAIL_BOX_UPDATE_ONLY = getattr(settings, 'QUEUE_EMAIL_BOX_UPDATE_ONLY', False)
|
||||
|
||||
# only allow users to access queues that they are members of?
|
||||
|
@ -1,7 +1,7 @@
|
||||
{% extends "helpdesk/base.html" %}
|
||||
{% load i18n bootstrap humanize %}
|
||||
{% load static from staticfiles %}
|
||||
{% block helpdesk_title %}{% trans "View Ticket Details" %}{% endblock %}
|
||||
{% block helpdesk_title %}{{ ticket.queue.slug }}-{{ ticket.id }} : {% trans "View Ticket Details" %}{% endblock %}
|
||||
{% block helpdesk_head %}
|
||||
<script type='text/javascript' language='javascript'>
|
||||
$(document).ready(function() {
|
||||
|
@ -29,7 +29,7 @@
|
||||
<th colspan='2'>{% trans "Description" %}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id="ticket-description" colspan='2'>{{ ticket.description|force_escape|urlizetrunc:50|linebreaksbr }}</td>
|
||||
<td id="ticket-description" colspan='2'>{{ ticket.description|force_escape|urlizetrunc:50|num_to_link|linebreaksbr }}</td>
|
||||
</tr>
|
||||
|
||||
{% if ticket.resolution %}<tr>
|
||||
|
@ -39,7 +39,7 @@ def num_to_link(text):
|
||||
if ticket:
|
||||
style = ticket.get_status_display()
|
||||
text = "%s <a href='%s' class='ticket_link_status ticket_link_status_%s'>#%s</a>%s" % (
|
||||
text[:match.start()], url, style, match.groups()[0], text[match.end():])
|
||||
text[:match.start() + 1], url, style, match.groups()[0], text[match.end():])
|
||||
return mark_safe(text)
|
||||
|
||||
register = template.Library()
|
||||
|
@ -10,6 +10,8 @@ try: # python 3
|
||||
except ImportError: # python 2
|
||||
from urlparse import urlparse
|
||||
|
||||
from helpdesk.templatetags.ticket_to_link import num_to_link
|
||||
|
||||
|
||||
class TicketActionsTestCase(TestCase):
|
||||
fixtures = ['emailtemplate.json']
|
||||
@ -122,6 +124,30 @@ class TicketActionsTestCase(TestCase):
|
||||
response = self.client.post(reverse('helpdesk:update', kwargs={'ticket_id': ticket_id}), post_data, follow=True)
|
||||
self.assertContains(response, 'Changed Status from Open to Closed')
|
||||
|
||||
def test_num_to_link(self):
|
||||
"""Test that we are correctly expanding links to tickets from IDs"""
|
||||
|
||||
# make staff user
|
||||
self.loginUser()
|
||||
|
||||
initial_data = {
|
||||
'title': 'Some private ticket',
|
||||
'queue': self.queue_public,
|
||||
'assigned_to': self.user,
|
||||
'status': Ticket.OPEN_STATUS,
|
||||
}
|
||||
|
||||
# create ticket
|
||||
ticket = Ticket.objects.create(**initial_data)
|
||||
ticket_id = ticket.id
|
||||
|
||||
# generate the URL text
|
||||
result = num_to_link('this is ticket#%s' % ticket_id)
|
||||
self.assertEqual(result, "this is ticket <a href='/helpdesk/tickets/%s/' class='ticket_link_status ticket_link_status_Open'>#%s</a>" % (ticket_id, ticket_id))
|
||||
|
||||
result2 = num_to_link('whoa another ticket is here #%s huh' % ticket_id)
|
||||
self.assertEqual(result2, "whoa another ticket is here <a href='/helpdesk/tickets/%s/' class='ticket_link_status ticket_link_status_Open'>#%s</a> huh" % (ticket_id, ticket_id))
|
||||
|
||||
def test_create_ticket_getform(self):
|
||||
self.loginUser()
|
||||
response = self.client.get(reverse('helpdesk:submit'), follow=True)
|
||||
|
Loading…
Reference in New Issue
Block a user