mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2024-11-24 08:53:40 +01:00
Deprecate VALID_EXTENSIONS properly
This commit is contained in:
parent
128a465d44
commit
ebbbcdb2aa
@ -49,7 +49,7 @@ These settings can be used to change who can access the helpdesk.
|
||||
|
||||
**Default:** ``HELPDESK_REDIRECT_TO_LOGIN_BY_DEFAULT = False``
|
||||
|
||||
- **HELPDESK_VALID_EXTENSIONS** Valid extensions for file types that can be attached to tickets
|
||||
- **HELPDESK_VALID_EXTENSIONS** Valid extensions for file types that can be attached to tickets. Note: This used to be calle **VALID_EXTENSIONS** which is now deprecated.
|
||||
|
||||
**Default:** ``HELPDESK_VALID_EXTENSIONS = ['.txt', '.asc', '.htm', '.html', '.pdf', '.doc', '.docx', '.odt', '.jpg', '.png', '.eml']
|
||||
|
||||
|
@ -10,6 +10,7 @@ from django.utils.translation import gettext_lazy as _
|
||||
import os
|
||||
import re
|
||||
import warnings
|
||||
import sys
|
||||
|
||||
|
||||
DEFAULT_USER_SETTINGS = {
|
||||
@ -337,7 +338,12 @@ HELPDESK_IMAP_DEBUG_LEVEL = getattr(settings, 'HELPDESK_IMAP_DEBUG_LEVEL', 0)
|
||||
# Override it in your own Django settings.py
|
||||
HELPDESK_ATTACHMENT_DIR_PERMS = int(getattr(settings, 'HELPDESK_ATTACHMENT_DIR_PERMS', "755"), 8)
|
||||
|
||||
HELPDESK_VALID_EXTENSIONS = getattr(settings, 'HELPDESK_VALID_EXTENSIONS', ['.txt', '.asc', '.htm', '.html', '.pdf', '.doc', '.docx', '.odt', '.jpg', '.png', '.eml'])
|
||||
HELPDESK_VALID_EXTENSIONS = getattr(settings, 'VALID_EXTENSIONS', None)
|
||||
if HELPDESK_VALID_EXTENSIONS:
|
||||
# Print to stderr
|
||||
print("VALID_EXTENSIONS is deprecated, use HELPDESK_VALID_EXTENSIONS instead", file=sys.stderr)
|
||||
else:
|
||||
HELPDESK_VALID_EXTENSIONS = getattr(settings, 'HELPDESK_VALID_EXTENSIONS', ['.txt', '.asc', '.htm', '.html', '.pdf', '.doc', '.docx', '.odt', '.jpg', '.png', '.eml'])
|
||||
|
||||
HELPDESK_VALIDATE_ATTACHMENT_TYPES = getattr(settings, 'HELPDESK_VALIDATE_ATTACHMENT_TYPES', True)
|
||||
|
||||
|
@ -51,12 +51,13 @@ class TicketViewSet(viewsets.ModelViewSet):
|
||||
|
||||
# filter by status
|
||||
status = self.request.query_params.get('status', None)
|
||||
if status:
|
||||
statuses = status.split(',') if status else []
|
||||
status_choices = helpdesk_settings.TICKET_STATUS_CHOICES
|
||||
number_statuses = []
|
||||
for status in statuses:
|
||||
for choice in status_choices:
|
||||
if choice[1] == status:
|
||||
if str(choice[0]) == status:
|
||||
number_statuses.append(choice[0])
|
||||
if number_statuses:
|
||||
tickets = tickets.filter(status__in=number_statuses)
|
||||
|
Loading…
Reference in New Issue
Block a user