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

Adds event handler to ignore not configured Slack reactions #3124

Merged
merged 1 commit into from
Mar 17, 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
14 changes: 13 additions & 1 deletion src/dispatch/plugins/dispatch_slack/incident/interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,11 @@ def configure(config):
middleware=[reaction_context_middleware],
)(handle_timeline_added_event)

app.event(
event="reaction_added",
middleware=[reaction_context_middleware],
)(handle_not_configured_reaction_event)


@app.options(
DefaultActionIds.tags_multi_select, middleware=[action_context_middleware, db_middleware]
Expand Down Expand Up @@ -639,10 +644,17 @@ def draw_task_modal(
# EVENTS


def handle_not_configured_reaction_event(
ack: Ack, client: Any, context: BoltContext, payload: Any, db_session: Session
) -> None:
"""Ignores reaction_added events for reactions that are not configured and mapped to a handler function."""
ack()


def handle_timeline_added_event(
ack: Ack, client: Any, context: BoltContext, payload: Any, db_session: Session
) -> None:
"""Handles an event where a reaction is added to a message."""
"""Handles an event where the configured timeline reaction is added to a message."""
ack()

conversation_id = context["channel_id"]
Expand Down