Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify SlackEventApiEndpointView methods #2384

Merged
merged 4 commits into from
Jun 29, 2023

Conversation

vadimkerr
Copy link
Member

@vadimkerr vadimkerr commented Jun 28, 2023

What this PR does

Simplifies _get_organization_from_payload and _get_slack_team_identity_from_payload methods on SlackEventApiEndpointView, so it's (hopefully) easier to grasp.

Checklist

  • Unit, integration, and e2e (if applicable) tests updated
  • Documentation added (or pr:no public docs PR label added if not required)
  • CHANGELOG.md updated (or pr:no changelog PR label added if not required)

@vadimkerr vadimkerr added pr:no changelog pr:no public docs Added to a PR that does not require public documentation updates labels Jun 28, 2023
@vadimkerr vadimkerr requested a review from a team June 28, 2023 16:33
@@ -79,8 +82,6 @@

logger = logging.getLogger(__name__)

SELECT_ORGANIZATION_AND_ROUTE_BLOCK_ID = "SELECT_ORGANIZATION_AND_ROUTE"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find any usages, so removing it.

@vadimkerr vadimkerr changed the title Simplify SlackEventApiEndpointView._get_organization_from_payload Simplify SlackEventApiEndpointView methods Jun 28, 2023

try:
slack_team_identity = SlackTeamIdentity.objects.get(slack_id=slack_team_id)
except SlackTeamIdentity.DoesNotExist as e:
logger.warning("Team identity not detected, that's dangerous!" + str(e))
Copy link
Member Author

@vadimkerr vadimkerr Jun 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already logged here

Copy link
Contributor

@joeyorlando joeyorlando left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Up to you, but it might be useful adding a few small unit tests for _get_organization_from_payload and _get_slack_team_identity_from_payload to ensure they handle all the possible payload scenarios as you'd expect.

@vadimkerr
Copy link
Member Author

@joeyorlando Thank you for the review! I'm currently working on #2336 and it will introduce a few changes to the Slack view, so I'm planning to add tests on most of this logic in subsequent PRs.

@vadimkerr vadimkerr added this pull request to the merge queue Jun 29, 2023
Merged via the queue into dev with commit aa2bb81 Jun 29, 2023
@vadimkerr vadimkerr deleted the vadimkerr/simplify-slack-payload-organization branch June 29, 2023 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:no public docs Added to a PR that does not require public documentation updates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants