mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-26 17:58:29 -04:00
Create go-live support tickets using the new way
The new way of creating support tickets can be seen in [notifications-utils](https://github.com/alphagov/notifications-utils/pull/899). This changes tickets created when making a request to go live to use the new way, while other tickets stay the same for now. The go live tags have been removed. Some of these had become unneccessary since you can't make the request to go live unless they are true (e.g. `notify_go_live_email_reply_to`). Others will always get added by a Zendesk macro when the ticket is replied to, so we don't need to add them here.
This commit is contained in:
@@ -14,6 +14,9 @@ from flask import (
|
||||
)
|
||||
from flask_login import current_user
|
||||
from notifications_python_client.errors import HTTPError
|
||||
from notifications_utils.clients.zendesk.zendesk_client import (
|
||||
NotifySupportTicket,
|
||||
)
|
||||
from notifications_utils.timezones import utc_string_to_aware_gmt_datetime
|
||||
|
||||
from app import (
|
||||
@@ -207,10 +210,7 @@ def request_to_go_live(service_id):
|
||||
@user_has_permissions('manage_service')
|
||||
@user_is_gov_user
|
||||
def submit_request_to_go_live(service_id):
|
||||
|
||||
zendesk_client.create_ticket(
|
||||
subject='Request to go live - {}'.format(current_service.name),
|
||||
message=(
|
||||
ticket_message = (
|
||||
'Service: {service_name}\n'
|
||||
'{service_dashboard}\n'
|
||||
'\n---'
|
||||
@@ -243,13 +243,20 @@ def submit_request_to_go_live(service_id):
|
||||
existing_live='Yes' if current_user.live_services else 'No',
|
||||
email_address=current_user.email_address,
|
||||
email_reply_to=current_service.default_email_reply_to_address or 'not set',
|
||||
),
|
||||
ticket_type=zendesk_client.TYPE_QUESTION,
|
||||
user_email=current_user.email_address,
|
||||
)
|
||||
|
||||
ticket = NotifySupportTicket(
|
||||
subject=f'Request to go live - {current_service.name}',
|
||||
message=ticket_message,
|
||||
ticket_type=NotifySupportTicket.TYPE_QUESTION,
|
||||
user_name=current_user.name,
|
||||
tags=current_service.request_to_go_live_tags,
|
||||
user_email=current_user.email_address,
|
||||
requester_sees_message_content=False,
|
||||
org_id=current_service.organisation_id,
|
||||
org_type=current_service.organisation_type,
|
||||
service_id=current_service.id,
|
||||
)
|
||||
zendesk_client.send_ticket_to_zendesk(ticket)
|
||||
|
||||
current_service.update(go_live_user=current_user.id)
|
||||
|
||||
|
||||
@@ -684,33 +684,6 @@ class Service(JSONModel):
|
||||
}
|
||||
)
|
||||
|
||||
@property
|
||||
def request_to_go_live_tags(self):
|
||||
return list(self._get_request_to_go_live_tags())
|
||||
|
||||
def _get_request_to_go_live_tags(self):
|
||||
|
||||
BASE = 'notify_go_live'
|
||||
|
||||
yield 'notify_action'
|
||||
yield BASE
|
||||
|
||||
if self.go_live_checklist_completed and self.organisation.agreement_signed:
|
||||
yield BASE + '_complete'
|
||||
return
|
||||
|
||||
for test, tag in (
|
||||
(not self.volumes, '_volumes'),
|
||||
(not self.go_live_checklist_completed, '_checklist'),
|
||||
(not self.organisation.agreement_signed, '_mou'),
|
||||
(self.needs_to_add_email_reply_to_address, '_email_reply_to'),
|
||||
(not self.has_team_members, '_team_member'),
|
||||
(not self.has_templates, '_template_content'),
|
||||
(self.needs_to_change_sms_sender, '_sms_sender'),
|
||||
):
|
||||
if test:
|
||||
yield BASE + '_incomplete' + tag
|
||||
|
||||
@cached_property
|
||||
def returned_letter_statistics(self):
|
||||
return service_api_client.get_returned_letter_statistics(self.id)
|
||||
|
||||
Reference in New Issue
Block a user