Skip to content

Commit

Permalink
fixup: accidentally removed a setting
Browse files Browse the repository at this point in the history
  • Loading branch information
GabDug committed Jan 2, 2024
1 parent 7e2e9b5 commit bb5c182
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 8 deletions.
4 changes: 4 additions & 0 deletions src/firefighter/firefighter/settings/components/slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
"SLACK_INCIDENT_HELP_GUIDE_URL", default=None
)
"URL to add in the Slack help message (/incident help). Useful to point to your own documentation."
SLACK_SEVERITY_HELP_GUIDE_URL: str | None = config(
"SLACK_SEVERITY_HELP_GUIDE_URL", default=None
)
"URL to add in the form to choose the priority. Useful to point to your own documentation."
SLACK_EMERGENCY_COMMUNICATION_GUIDE_URL: str | None = config(
"SLACK_EMERGENCY_COMMUNICATION_GUIDE_URL", default=None
)
Expand Down
3 changes: 0 additions & 3 deletions src/firefighter/raid/views/open_normal.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import logging
from typing import TYPE_CHECKING

from django.conf import settings
from slack_sdk.models.blocks.basic_components import MarkdownTextObject
from slack_sdk.models.blocks.blocks import ContextBlock

Expand All @@ -23,8 +22,6 @@

logger = logging.getLogger(__name__)

SLACK_SEVERITY_HELP_GUIDE_URL: str = settings.SLACK_SEVERITY_HELP_GUIDE_URL

slack_fields: SlackFormAttributesDict = {
"title": {
"input": {
Expand Down
11 changes: 9 additions & 2 deletions src/firefighter/slack/views/modals/open.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
app = SlackApp()
logger = logging.getLogger(__name__)

SLACK_SEVERITY_HELP_GUIDE_URL: str = settings.SLACK_SEVERITY_HELP_GUIDE_URL
SLACK_SEVERITY_HELP_GUIDE_URL: str | None = settings.SLACK_SEVERITY_HELP_GUIDE_URL


INCIDENT_TYPES: dict[ResponseType, dict[str, dict[str, Any]]] = {
Expand Down Expand Up @@ -411,7 +411,14 @@ def _build_response_type_blocks(open_incident_context: OpeningData) -> list[Bloc
MarkdownTextObject(
text=f"> {priority.emoji} Selected priority: {priority}"
+ (
f"\n> Critical incidents are for *emergency* only, <{SLACK_SEVERITY_HELP_GUIDE_URL}|learn more>."
(
"\n> Critical incidents are for *emergency* only"
+ (
f"<{SLACK_SEVERITY_HELP_GUIDE_URL}|learn more>"
if SLACK_SEVERITY_HELP_GUIDE_URL
else "" + "."
)
)
if selected_response_type == "critical"
else ""
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ class CreateIncidentFormSlack(CreateIncidentForm):
"widget": {
"post_block": SectionBlock(
text=f"_<{settings.SLACK_SEVERITY_HELP_GUIDE_URL}|How to choose the priority?>_"
),
)
if settings.SLACK_SEVERITY_HELP_GUIDE_URL
else None,
"label_from_instance": lambda obj: f"{obj.emoji} {obj.name} - {obj.description}",
},
},
Expand Down
5 changes: 3 additions & 2 deletions src/firefighter/slack/views/modals/update_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ class UpdateStatusFormSlack(UpdateStatusForm):
"widget": {
"post_block": SectionBlock(
text=f"_<{settings.SLACK_SEVERITY_HELP_GUIDE_URL}|How to choose the priority?>_"
),
# XXX Link to new Priority doc
)
if settings.SLACK_SEVERITY_HELP_GUIDE_URL
else None,
"label_from_instance": priority_label,
},
},
Expand Down

0 comments on commit bb5c182

Please sign in to comment.