Skip to content

Commit

Permalink
Added visibility to welcome message (Netflix#3019) (#30)
Browse files Browse the repository at this point in the history
* Added visibility to welcome message

* Update src/dispatch/incident/messaging.py



* Update src/dispatch/messaging/strings.py



* Update src/dispatch/messaging/strings.py



* Update src/dispatch/messaging/strings.py



* Update src/dispatch/messaging/strings.py



* updated visibility

---------

Co-authored-by: jneelamekam <67976897+jneelamekam@users.noreply.github.com>
Co-authored-by: Janani Neelamekam <jneelamekam@netflix.com>
Co-authored-by: Will Sheldon <114631109+wssheldon@users.noreply.github.com>
Co-authored-by: Marc Vilanova <39573146+mvilanova@users.noreply.github.com>
  • Loading branch information
5 people authored Mar 17, 2023
1 parent eb253f8 commit 1537d01
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/dispatch/incident/messaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def send_welcome_ephemeral_message_to_participant(
"name": incident.name,
"title": incident.title,
"description": incident_description,
"visibility": incident.visibility,
"status": incident.status,
"type": incident.incident_type.name,
"type_description": incident.incident_type.description,
Expand Down Expand Up @@ -161,6 +162,7 @@ def send_welcome_email_to_participant(
"name": incident.name,
"title": incident.title,
"description": incident_description,
"visibility": incident.visibility,
"status": incident.status,
"type": incident.incident_type.name,
"type_description": incident.incident_type.description,
Expand Down Expand Up @@ -300,6 +302,7 @@ def send_incident_created_notifications(incident: Incident, db_session: SessionL
"name": incident.name,
"title": incident.title,
"description": incident_description,
"visibility": incident.visibility,
"status": incident.status,
"type": incident.incident_type.name,
"type_description": incident.incident_type.description,
Expand Down
14 changes: 14 additions & 0 deletions src/dispatch/messaging/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from dispatch.conversation.enums import ConversationButtonActions
from dispatch.incident.enums import IncidentStatus
from dispatch.enums import Visibility

from dispatch.enums import DispatchEnum, DocumentResourceTypes, DocumentResourceReferenceTypes

Expand Down Expand Up @@ -34,6 +35,10 @@ class MessageType(DispatchEnum):
IncidentStatus.closed: "This no longer requires additional involvement, long term incident action items have been assigned to their respective owners.",
}

INCIDENT_VISIBILITY_DESCRIPTIONS = {
Visibility.open: "We ask that you use your best judgment while sharing details about this incident outside of the dedicated channels of communication. Please reach out to the Incident Commander if you have any questions.",
Visibility.restricted: "This incident is restricted to immediate participants of this incident. We ask that you exercise extra caution and discretion while talking about this incident outside of the dedicated channels of communication. Only invite new participants that are strictly necessary. Please reach out to the Incident Commander if you have any questions.",
}
EVERGREEN_REMINDER_DESCRIPTION = """
You are the owner of the following resources in Dispatch.
This is a reminder that these resources should be kept up to date in order to effectively
Expand Down Expand Up @@ -373,6 +378,11 @@ class MessageType(DispatchEnum):
"status_mapping": INCIDENT_STATUS_DESCRIPTIONS,
}

INCIDENT_VISIBILITY = {
"title": "Visibility - {{visibility}}",
"visibility_mapping": INCIDENT_VISIBILITY_DESCRIPTIONS,
}

INCIDENT_TYPE = {"title": "Type - {{type}}", "text": "{{type_description}}"}

INCIDENT_SEVERITY = {
Expand Down Expand Up @@ -475,6 +485,7 @@ class MessageType(DispatchEnum):
INCIDENT_PARTICIPANT_WELCOME,
INCIDENT_TITLE,
INCIDENT_DESCRIPTION,
INCIDENT_VISIBILITY,
INCIDENT_STATUS,
INCIDENT_TYPE,
INCIDENT_SEVERITY,
Expand Down Expand Up @@ -748,6 +759,9 @@ def render_message_template(message_template: List[dict], **kwargs):
if button.get("button_url"):
button["button_url"] = Template(button["button_url"]).render(**kwargs)

if d.get("visibility_mapping"):
d["text"] = d["visibility_mapping"][kwargs["visibility"]]

if d.get("status_mapping"):
d["text"] = d["status_mapping"][kwargs["status"]]

Expand Down

0 comments on commit 1537d01

Please sign in to comment.