Skip to content

Commit

Permalink
Deduplicates participants lists before they're used for adding users …
Browse files Browse the repository at this point in the history
…to conversations or threads (#3533)

* Deduplicates list of Slack user ids before using them for looping them into cases

* dedupes participants lists in plugin module

* removes blank line
  • Loading branch information
mvilanova authored Jun 28, 2023
1 parent 2c57676 commit 6343ee9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/dispatch/plugins/dispatch_slack/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def send_ephemeral(
def add(self, conversation_id: str, participants: List[str]):
"""Adds users to conversation."""
client = create_slack_client(self.configuration)
participants = [resolve_user(client, p)["id"] for p in participants]
participants = [resolve_user(client, p)["id"] for p in set(participants)]

archived = conversation_archived(client, conversation_id)
if not archived:
Expand All @@ -247,7 +247,7 @@ def add(self, conversation_id: str, participants: List[str]):
def add_to_thread(self, conversation_id: str, thread_id: str, participants: List[str]):
"""Adds users to a thread conversation."""
client = create_slack_client(self.configuration)
participants = [resolve_user(client, p)["id"] for p in participants]
participants = [resolve_user(client, p)["id"] for p in set(participants)]
add_users_to_conversation_thread(client, conversation_id, thread_id, participants)

def archive(self, conversation_id: str):
Expand Down

0 comments on commit 6343ee9

Please sign in to comment.