From 64fd42c28eb89cb7f9fe3c5e0d58a2dba6eb7a85 Mon Sep 17 00:00:00 2001 From: Marc Vilanova Date: Fri, 17 Mar 2023 10:03:31 -0700 Subject: [PATCH] Adds event handler to ignore not configured Slack reactions --- .../plugins/dispatch_slack/incident/interactive.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/dispatch/plugins/dispatch_slack/incident/interactive.py b/src/dispatch/plugins/dispatch_slack/incident/interactive.py index d9ebe85b7cdc..b744f900b4da 100644 --- a/src/dispatch/plugins/dispatch_slack/incident/interactive.py +++ b/src/dispatch/plugins/dispatch_slack/incident/interactive.py @@ -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] @@ -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"]