Skip to content

Commit

Permalink
Declutters Slack case threads (#3994)
Browse files Browse the repository at this point in the history
* Declutters Slack case threads

* Update src/dispatch/plugins/dispatch_slack/case/messages.py

Co-authored-by: Will Sheldon <[email protected]>

* Update src/dispatch/plugins/dispatch_slack/case/messages.py

Co-authored-by: Will Sheldon <[email protected]>

---------

Co-authored-by: Will Sheldon <[email protected]>
  • Loading branch information
mvilanova and wssheldon authored Nov 15, 2023
1 parent b672afc commit 090a8fe
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
7 changes: 3 additions & 4 deletions src/dispatch/plugins/dispatch_slack/case/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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="*Alerts*"),
Divider(),
Section(text=f"{num_of_instances} alerts observed in this case."),
Section(text="\n*Entities*"),
Divider(),
]
Expand Down
6 changes: 0 additions & 6 deletions src/dispatch/plugins/dispatch_slack/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/dispatch/plugins/dispatch_slack/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 090a8fe

Please sign in to comment.