Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added visibility to welcome message #3019

Merged
merged 11 commits into from
Mar 3, 2023
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"):
jneelamekam marked this conversation as resolved.
Show resolved Hide resolved
d["text"] = d["visibility_mapping"][kwargs["visibility"]]

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

Expand Down