Skip to content
This repository was archived by the owner on Sep 3, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/dispatch/case/messaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
CASE_TYPE_CHANGE,
CASE_SEVERITY_CHANGE,
CASE_PRIORITY_CHANGE,
CASE_VISIBILITY_CHANGE,
CASE_CLOSED_RATING_FEEDBACK_NOTIFICATION,
MessageType,
generate_welcome_message,
Expand Down Expand Up @@ -219,6 +220,10 @@ def send_case_update_notifications(case: Case, previous_case: CaseRead, db_sessi
change = True
notification_template.append(CASE_PRIORITY_CHANGE)

if previous_case.visibility != case.visibility:
change = True
notification_template.append(CASE_VISIBILITY_CHANGE)

if not change:
# we don't need to send notifications
log.debug("Case updated notifications not sent. No changes were made.")
Expand Down Expand Up @@ -251,6 +256,8 @@ def send_case_update_notifications(case: Case, previous_case: CaseRead, db_sessi
case_status_old=previous_case.status,
case_type_new=case.case_type.name,
case_type_old=previous_case.case_type.name,
case_visibility_new=case.visibility,
case_visibility_old=previous_case.visibility,
name=case.name,
ticket_weblink=case.ticket.weblink,
title=case.title,
Expand Down Expand Up @@ -286,6 +293,8 @@ def send_case_update_notifications(case: Case, previous_case: CaseRead, db_sessi
"case_status_old": previous_case.status,
"case_type_new": case.case_type.name,
"case_type_old": previous_case.case_type.name,
"case_visibility_new": case.visibility,
"case_visibility_old": previous_case.visibility,
"name": case.name,
"organization_slug": case.project.organization.slug,
"ticket_weblink": resolve_attr(case, "ticket.weblink"),
Expand Down
10 changes: 10 additions & 0 deletions src/dispatch/messaging/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,11 @@ class MessageType(DispatchEnum):
"\n", " "
).strip()

CASE_VISIBILITY_CHANGE_DESCRIPTION = """
The case visibility has been changed from {{ case_visibility_old }} to {{ case_visibility_new }}.""".replace(
"\n", " "
).strip()

CASE_STATUS_CHANGE = {
"title": "Status Change",
"text": CASE_STATUS_CHANGE_DESCRIPTION,
Expand All @@ -575,6 +580,11 @@ class MessageType(DispatchEnum):
"text": CASE_PRIORITY_CHANGE_DESCRIPTION,
}

CASE_VISIBILITY_CHANGE = {
"title": "Visibility Change",
"text": CASE_VISIBILITY_CHANGE_DESCRIPTION,
}

INCIDENT_NAME = {
"title": "{{name}} Incident Notification",
"title_link": "{{ticket_weblink}}",
Expand Down
Loading