Skip to content

Commit

Permalink
Fix mattermost channel selection (robusta-dev#1125)
Browse files Browse the repository at this point in the history
* fix mattermost channel selection

* indentation fix
  • Loading branch information
daanvinken authored and pavangudiwada committed Nov 6, 2023
1 parent 00bcfde commit 829aa33
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/robusta/integrations/mattermost/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,12 @@ def get_channel_id(self, channel_name: str) -> Optional[str]:
response = response.json()
if not len(response):
return None
return response[0].get("id")
# Search can return mulitple channels, check the name
for chan in response:
if chan["name"] == channel_name:
return chan["id"]
else:
logging.error("Received error response from MM on channel search: {str(response)}")

def get_team_id(self, team_name: str) -> Optional[str]:
if not self.is_admin:
Expand Down

0 comments on commit 829aa33

Please sign in to comment.