Merge pull request #1277 from bhargav1002/feat/ticket-hold-followup-change-tracking

Prevent Ticket.title being changed and instead add follow-up creation and change tracking on ticket hold status with the FollowUp.title reflecting the hold state.
This commit is contained in:
Christopher Broderick 2025-06-09 13:51:15 +02:00 committed by GitHub
commit 0b9fe0cb76
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 11 deletions

View File

@ -71,6 +71,7 @@ from helpdesk.models import (
SavedSearch, SavedSearch,
Ticket, Ticket,
TicketCC, TicketCC,
TicketChange,
TicketCustomFieldValue, TicketCustomFieldValue,
TicketDependency, TicketDependency,
UserSettings, UserSettings,
@ -89,6 +90,7 @@ import re
from rest_framework import status from rest_framework import status
from rest_framework.decorators import api_view from rest_framework.decorators import api_view
import typing import typing
from django.utils.timezone import now
if helpdesk_settings.HELPDESK_KB_ENABLED: if helpdesk_settings.HELPDESK_KB_ENABLED:
@ -1384,21 +1386,28 @@ def hold_ticket(request, ticket_id, unhold=False):
if unhold: if unhold:
ticket.on_hold = False ticket.on_hold = False
title = _("Ticket taken off hold") followup_title = _("Ticket taken off hold")
else: else:
ticket.on_hold = True ticket.on_hold = True
title = _("Ticket placed on hold") followup_title = _("Ticket placed on hold")
f = update_ticket(
user=request.user,
ticket=ticket,
title=title,
public=True,
)
f.save()
ticket.save() ticket.save()
followup = FollowUp.objects.create(
ticket=ticket,
title=followup_title,
date=now(),
public=True,
user=request.user,
)
TicketChange.objects.create(
followup=followup,
field=_("On Hold"),
old_value=str(not ticket.on_hold),
new_value=str(ticket.on_hold),
)
return HttpResponseRedirect(ticket.get_absolute_url()) return HttpResponseRedirect(ticket.get_absolute_url())

View File

@ -7,7 +7,7 @@ from setuptools import find_packages, setup
import sys import sys
version = "1.5.1" version = "1.6.0"
# Provided as an attribute, so you can append to these instead # Provided as an attribute, so you can append to these instead