Skip to content

Commit

Permalink
respect opt-out even when reporting error
Browse files Browse the repository at this point in the history
  • Loading branch information
daabr committed Dec 30, 2024
1 parent 7816198 commit 0d33592
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions purrr/slack_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from slack_sdk.errors import SlackApiError

import data_helper
import debug
import markdown
import slack_helper
Expand Down Expand Up @@ -61,11 +62,11 @@ def initialize_for_github_pr(action: str, pr, sender) -> None:

def _report_creation_error(pr, github_username) -> None:
"""Report to the PR sender that a Slack channel wasn't created for it, and abort."""
user_id = users.github_username_to_slack_user_id(github_username)
error = "Failed to create Slack channel for " + pr.html_url
debug.log(error)

if user_id:
user_id = users.github_username_to_slack_user_id(github_username)
if user_id and not data_helper.slack_opted_out(user_id):
slack.chat_postMessage(channel=user_id, text=error)

raise RuntimeError(error)
Expand Down

0 comments on commit 0d33592

Please sign in to comment.