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

Do not try to render Slack Button with empty url in Signal message #4099

Merged
merged 4 commits into from
Dec 15, 2023
Merged
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
10 changes: 9 additions & 1 deletion src/dispatch/plugins/dispatch_slack/case/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,20 @@ def create_signal_messages(case_id: int, channel_id: str, db_session: Session) -
action_id=SignalNotificationActions.snooze,
value=button_metadata,
),
]
# The button URL must have at least one character.
# Otherwise, Slack will raise a Validation error.
# external_url is not a required field. If it's empty, an empty list is added,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we make it required in the UI instead, so we always have a link to a response plan for all detections?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay, we could take that approach. I was worried about introducing friction. For example, creating new detections as part of an incident.

I can make it a required field though if you feel strongly about it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mvilanova Going to merge this for now -- let me know and I can go the required route instead.

# which effectively doesn't add anything to the elements list.
+ [
Button(
text="Response Plan",
action_id="button-link",
url=first_instance_signal.external_url,
),
)
]
if first_instance_signal.external_url
else []
),
Section(text="*Alerts*"),
Divider(),
Expand Down
Loading