Issue #1235 - Escalation only notify users

This commit is contained in:
DavidVadnais 2025-02-03 20:59:39 +00:00
parent 43a71e89f7
commit f43e0474a7

View File

@ -33,9 +33,17 @@ class Command(BaseCommand):
default=False, default=False,
help='Display escalated tickets' help='Display escalated tickets'
) )
parser.add_argument(
'-n',
'--notify-only',
action='store_true',
default=False,
help='Send email reminder but dont escalate tickets'
)
def handle(self, *args, **options): def handle(self, *args, **options):
verbose = options['escalate_verbosely'] verbose = options['escalate_verbosely']
notify_only = options['notify_only']
queue_slugs = options['queues'] queue_slugs = options['queues']
# Only include queues with escalation configured # Only include queues with escalation configured
@ -87,14 +95,15 @@ class Command(BaseCommand):
if verbose: if verbose:
self.stdout.write(f" - Esclating {ticket.ticket} from {ticket.priority + 1}>{ticket.priority}") self.stdout.write(f" - Esclating {ticket.ticket} from {ticket.priority + 1}>{ticket.priority}")
followup = ticket.followup_set.create( if not notify_only:
title=_('Ticket Escalated'), followup = ticket.followup_set.create(
public=True, title=_('Ticket Escalated'),
comment=_('Ticket escalated after %(nb)s days') % {'nb': queue.escalate_days}, public=True,
) comment=_('Ticket escalated after %(nb)s days') % {'nb': queue.escalate_days},
)
followup.ticketchange_set.create( followup.ticketchange_set.create(
field=_('Priority'), field=_('Priority'),
old_value=ticket.priority + 1, old_value=ticket.priority + 1,
new_value=ticket.priority, new_value=ticket.priority,
) )