From 2f68f894b618815897d04a7ac174e0a88a7e60ad Mon Sep 17 00:00:00 2001 From: Marc Vilanova Date: Wed, 15 Nov 2023 12:48:26 -0800 Subject: [PATCH 1/3] Declutters Slack case threads --- src/dispatch/plugins/dispatch_slack/case/messages.py | 7 +++---- src/dispatch/plugins/dispatch_slack/plugin.py | 6 ------ src/dispatch/plugins/dispatch_slack/service.py | 4 +++- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/dispatch/plugins/dispatch_slack/case/messages.py b/src/dispatch/plugins/dispatch_slack/case/messages.py index 32eab6c4e775..d2899c28c4c9 100644 --- a/src/dispatch/plugins/dispatch_slack/case/messages.py +++ b/src/dispatch/plugins/dispatch_slack/case/messages.py @@ -192,9 +192,6 @@ def create_signal_messages(case_id: int, channel_id: str, db_session: Session) - ).json() signal_metadata_blocks = [ - Section( - text=f"*{first_instance_signal.name}* - {first_instance_signal.variant}", - ), Actions( elements=[ Button( @@ -214,7 +211,9 @@ def create_signal_messages(case_id: int, channel_id: str, db_session: Session) - ), ] ), - Section(text=f"Total instances in this case: *{num_of_instances}*\n"), + Section(text="*Signal Instances*"), + Divider(), + Section(text=f"{num_of_instances} signal instances observed in this case."), Section(text="\n*Entities*"), Divider(), ] diff --git a/src/dispatch/plugins/dispatch_slack/plugin.py b/src/dispatch/plugins/dispatch_slack/plugin.py index fb016f5f52a8..867604b5f101 100644 --- a/src/dispatch/plugins/dispatch_slack/plugin.py +++ b/src/dispatch/plugins/dispatch_slack/plugin.py @@ -78,12 +78,6 @@ def create_threaded(self, case: Case, conversation_id: str, db_session: Session) client = create_slack_client(self.configuration) blocks = create_case_message(case=case, channel_id=conversation_id) response = send_message(client=client, conversation_id=conversation_id, blocks=blocks) - send_message( - client=client, - conversation_id=conversation_id, - text="All real-time case collaboration should be captured in this thread.", - ts=response["timestamp"], - ) if case.signal_instances: message = create_signal_messages( case_id=case.id, channel_id=conversation_id, db_session=db_session diff --git a/src/dispatch/plugins/dispatch_slack/service.py b/src/dispatch/plugins/dispatch_slack/service.py index 6de65c05c185..475b153d9400 100644 --- a/src/dispatch/plugins/dispatch_slack/service.py +++ b/src/dispatch/plugins/dispatch_slack/service.py @@ -247,7 +247,9 @@ def add_users_to_conversation_thread( add_users_to_conversation(client=client, conversation_id=conversation_id, user_ids=user_ids) blocks = Message( blocks=[ - Section(text="Looping in individuals to help resolve this case...", fields=users) + Section( + text="Adding the following individuals to help resolve this case:", fields=users + ) ] ).build()["blocks"] send_message(client=client, conversation_id=conversation_id, blocks=blocks, ts=thread_id) From 288c68943cfdd8a9d49c0043142dee091ec1d91c Mon Sep 17 00:00:00 2001 From: Marc Vilanova <39573146+mvilanova@users.noreply.github.com> Date: Wed, 15 Nov 2023 12:54:06 -0800 Subject: [PATCH 2/3] Update src/dispatch/plugins/dispatch_slack/case/messages.py Co-authored-by: Will Sheldon <114631109+wssheldon@users.noreply.github.com> --- src/dispatch/plugins/dispatch_slack/case/messages.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dispatch/plugins/dispatch_slack/case/messages.py b/src/dispatch/plugins/dispatch_slack/case/messages.py index d2899c28c4c9..80bb97e5701f 100644 --- a/src/dispatch/plugins/dispatch_slack/case/messages.py +++ b/src/dispatch/plugins/dispatch_slack/case/messages.py @@ -213,7 +213,7 @@ def create_signal_messages(case_id: int, channel_id: str, db_session: Session) - ), Section(text="*Signal Instances*"), Divider(), - Section(text=f"{num_of_instances} signal instances observed in this case."), + Section(text=f"{num_of_instances} alerts observed in this case."), Section(text="\n*Entities*"), Divider(), ] From 5bba3ca23eecf98f16d6f8e78b39262b6daaf3f3 Mon Sep 17 00:00:00 2001 From: Marc Vilanova <39573146+mvilanova@users.noreply.github.com> Date: Wed, 15 Nov 2023 12:57:48 -0800 Subject: [PATCH 3/3] Update src/dispatch/plugins/dispatch_slack/case/messages.py Co-authored-by: Will Sheldon <114631109+wssheldon@users.noreply.github.com> --- src/dispatch/plugins/dispatch_slack/case/messages.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dispatch/plugins/dispatch_slack/case/messages.py b/src/dispatch/plugins/dispatch_slack/case/messages.py index 80bb97e5701f..9163f6d57644 100644 --- a/src/dispatch/plugins/dispatch_slack/case/messages.py +++ b/src/dispatch/plugins/dispatch_slack/case/messages.py @@ -211,7 +211,7 @@ def create_signal_messages(case_id: int, channel_id: str, db_session: Session) - ), ] ), - Section(text="*Signal Instances*"), + Section(text="*Alerts*"), Divider(), Section(text=f"{num_of_instances} alerts observed in this case."), Section(text="\n*Entities*"),