Skip to content

Commit

Permalink
File change
Browse files Browse the repository at this point in the history
  • Loading branch information
sentry-autofix[bot] authored Nov 27, 2024
1 parent 6c4e77a commit b17d6b0
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/sentry/integrations/slack/webhooks/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,13 +662,25 @@ def handle_member_approval(self, slack_request: SlackActionRequest, action: str)
if not identity_user:
return self.respond_with_text(NO_IDENTITY_MESSAGE)

member_id = slack_request.callback_data["member_id"]
callback_data = slack_request.callback_data
if not callback_data:
logger.error(
"slack.action.missing-callback-data",
extra={
"slack_team_id": slack_request.team_id,
"action": action,
},
)
return self.respond_with_text("Invalid request data received")
member_id = callback_data.get("member_id")
if not member_id:
return self.respond_with_text("Member ID not found in request")

try:
member = OrganizationMember.objects.get_member_invite_query(member_id).get()
except OrganizationMember.DoesNotExist:
# member request is gone, likely someone else rejected it
member_email = slack_request.callback_data["member_email"]
member_email = callback_data.get("member_email", "unknown")
return self.respond_with_text(f"Member invitation for {member_email} no longer exists.")
return self.respond_with_text(f"Member invitation for {member_email} no longer exists.")

organization = member.organization
Expand Down

0 comments on commit b17d6b0

Please sign in to comment.