mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2025-01-12 17:08:46 +01:00
Merge pull request #406 from mrkiwi-nz/master
Fix Issue #404: Refactor converting query string into queue:id
This commit is contained in:
commit
d65c32487c
@ -562,6 +562,14 @@ class Ticket(models.Model):
|
||||
|
||||
super(Ticket, self).save(*args, **kwargs)
|
||||
|
||||
@classmethod
|
||||
def queue_and_id_from_query(klass, query):
|
||||
# Apply the opposite logic here compared to self._get_ticket_for_url
|
||||
# Ensure that queues with '-' in them will work
|
||||
parts = query.split('-')
|
||||
queue = '-'.join(parts[0:-1])
|
||||
return queue, parts[-1]
|
||||
|
||||
|
||||
class FollowUpManager(models.Manager):
|
||||
def private_followups(self):
|
||||
|
@ -78,10 +78,7 @@ def view_ticket(request):
|
||||
error_message = ''
|
||||
|
||||
if ticket_req and email:
|
||||
parts = ticket_req.split('-')
|
||||
queue = '-'.join(parts[0:-1])
|
||||
ticket_id = parts[-1]
|
||||
|
||||
queue, ticket_id = Ticket.queue_and_id_from_query(ticket_req)
|
||||
try:
|
||||
ticket = Ticket.objects.get(id=ticket_id, submitter_email__iexact=email)
|
||||
except:
|
||||
|
@ -739,7 +739,7 @@ def ticket_list(request):
|
||||
filter = None
|
||||
if query.find('-') > 0:
|
||||
try:
|
||||
queue, id = query.split('-')
|
||||
queue, id = Ticket.queue_and_id_from_query(query)
|
||||
id = int(id)
|
||||
except ValueError:
|
||||
id = None
|
||||
|
Loading…
Reference in New Issue
Block a user