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

fix(hybrid-cloud): Uncache organization when queueing it for deletion #45213

Merged
merged 1 commit into from
Feb 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/sentry/api/endpoints/organization_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,7 @@ def handle_delete(self, request: Request, organization):
transaction_id=schedule.guid,
)
organization.send_delete_confirmation(entry, ONE_DAY)
Organization.objects.uncache_object(organization.id)
context = serialize(
organization,
request.user,
Expand Down
4 changes: 4 additions & 0 deletions tests/sentry/api/endpoints/test_organization_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,10 @@ def test_can_remove_as_owner(self):
# No owners should be remaining
assert len(owner_emails) == 0

# Ensure cache was flushed
org = Organization.objects.get_from_cache(slug=org.slug)
assert org.status == OrganizationStatus.PENDING_DELETION

def test_cannot_remove_as_admin(self):
org = self.create_organization(owner=self.user)
user = self.create_user(email="foo@example.com", is_superuser=False)
Expand Down