Merge branch 'main' into main

This commit is contained in:
Christopher Broderick 2023-03-10 23:48:29 +00:00 committed by GitHub
commit d147f8b1a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 41 additions and 41 deletions

View File

@ -499,6 +499,11 @@ def create_object_from_email_message(message, ticket_id, payload, files, logger)
logger.info( logger.info(
"Message seems to be auto-reply, not sending any emails back to the sender") "Message seems to be auto-reply, not sending any emails back to the sender")
else: else:
send_info_email(message_id, f, ticket, context, queue, new)
return ticket
def send_info_email(message_id: str, f: FollowUp, ticket: Ticket, context: dict, queue: dict, new: bool):
# send mail to appropriate people now depending on what objects # send mail to appropriate people now depending on what objects
# were created and who was CC'd # were created and who was CC'd
# Add auto-reply headers because it's an auto-reply and we must # Add auto-reply headers because it's an auto-reply and we must
@ -531,8 +536,6 @@ def create_object_from_email_message(message, ticket_id, payload, files, logger)
extra_headers=extra_headers, extra_headers=extra_headers,
) )
return ticket
def get_ticket_id_from_subject_slug( def get_ticket_id_from_subject_slug(
queue_slug: str, queue_slug: str,

View File

@ -81,12 +81,12 @@ def text_is_spam(text, request):
# This will return 'True' is the given text is deemed to be spam, or # This will return 'True' is the given text is deemed to be spam, or
# False if it is not spam. If it cannot be checked for some reason, we # False if it is not spam. If it cannot be checked for some reason, we
# assume it isn't spam. # assume it isn't spam.
from django.contrib.sites.models import Site
from django.core.exceptions import ImproperlyConfigured
try: try:
from akismet import Akismet from akismet import Akismet
except ImportError: except ImportError:
return False return False
from django.contrib.sites.models import Site
from django.core.exceptions import ImproperlyConfigured
try: try:
site = Site.objects.get_current() site = Site.objects.get_current()
except ImproperlyConfigured: except ImproperlyConfigured:

View File

@ -151,7 +151,7 @@ urlpatterns += [
urlpatterns += [ urlpatterns += [
re_path( re_path(
r"^rss/user/(?P<user_name>[a-zA-Z0-9\_\.]+)/", r"^rss/user/(?P<user_name>[^/]+)/",
helpdesk_staff_member_required(feeds.OpenTicketsByUser()), helpdesk_staff_member_required(feeds.OpenTicketsByUser()),
name="rss_user", name="rss_user",
), ),

View File

@ -23,7 +23,9 @@ from django.http import Http404, HttpResponse, HttpResponseRedirect, JsonRespons
from django.shortcuts import get_object_or_404, redirect, render from django.shortcuts import get_object_or_404, redirect, render
from django.urls import reverse, reverse_lazy from django.urls import reverse, reverse_lazy
from django.utils import timezone from django.utils import timezone
from django.utils.dateparse import parse_datetime
from django.utils.html import escape from django.utils.html import escape
from django.utils.timezone import make_aware
from django.utils.translation import gettext as _ from django.utils.translation import gettext as _
from django.views.decorators.csrf import requires_csrf_token from django.views.decorators.csrf import requires_csrf_token
from django.views.generic.edit import FormView, UpdateView from django.views.generic.edit import FormView, UpdateView
@ -536,12 +538,7 @@ def get_due_date_from_request_or_ticket(
due_date = request.POST.get('due_date', None) or None due_date = request.POST.get('due_date', None) or None
if due_date is not None: if due_date is not None:
# based on Django code to parse dates: due_date = make_aware(parse_datetime(due_date))
# https://docs.djangoproject.com/en/2.0/_modules/django/utils/dateparse/
match = DATE_RE.match(due_date)
if match:
kw = {k: int(v) for k, v in match.groupdict().items()}
due_date = date(**kw)
else: else:
due_date_year = int(request.POST.get('due_date_year', 0)) due_date_year = int(request.POST.get('due_date_year', 0))
due_date_month = int(request.POST.get('due_date_month', 0)) due_date_month = int(request.POST.get('due_date_month', 0))