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

feat(org member invite): OrganizationMemberInviteDetails DELETE endpoint #88587

Open
wants to merge 4 commits into
base: mifu67/member-invite/omi-details-put
Choose a base branch
from

Conversation

mifu67
Copy link
Contributor

@mifu67 mifu67 commented Apr 2, 2025

Delete an OrganizationMemberInvite object from the database. This is used to delete invites and reject invite requests.

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 2, 2025
audit_data = invited_member.get_audit_log_data()
event_name = "INVITE_REMOVE" if invited_member.invite_approved else "INVITE_REQUEST_REMOVE"
with transaction.atomic(router.db_for_write(OrganizationMemberInvite)):
invited_member.delete()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I unfortunately need to move this to a method on the model to support rejecting an invite request via slack ;_;

Copy link

codecov bot commented Apr 2, 2025

❌ 3 Tests Failed:

Tests completed Failed Passed Skipped
25025 3 25022 298
View the top 3 failed test(s) by shortest run time
tests.snuba.api.endpoints.test_project_trace_item_details.ProjectEventDetailsTest::test_simple_using_logs_item_type
Stack Traces | 3.12s run time
#x1B[1m#x1B[.../api/endpoints/test_project_trace_item_details.py#x1B[0m:163: in test_simple_using_logs_item_type
    assert trace_details_response.status_code == 200, trace_details_response.content
#x1B[1m#x1B[31mE   AssertionError: b'{"detail":"Internal Error","errorId":null}'#x1B[0m
#x1B[1m#x1B[31mE   assert 500 == 200#x1B[0m
#x1B[1m#x1B[31mE    +  where 500 = <Response status_code=500, "application/json">.status_code#x1B[0m
tests.snuba.api.endpoints.test_project_trace_item_details.ProjectEventDetailsTest::test_simple_using_spans_item_type
Stack Traces | 3.39s run time
#x1B[1m#x1B[.../api/endpoints/test_project_trace_item_details.py#x1B[0m:208: in test_simple_using_spans_item_type
    assert trace_details_response.status_code == 200, trace_details_response.content
#x1B[1m#x1B[31mE   AssertionError: b'{"detail":"Internal Error","errorId":null}'#x1B[0m
#x1B[1m#x1B[31mE   assert 500 == 200#x1B[0m
#x1B[1m#x1B[31mE    +  where 500 = <Response status_code=500, "application/json">.status_code#x1B[0m
tests.snuba.api.endpoints.test_project_trace_item_details.ProjectEventDetailsTest::test_simple
Stack Traces | 3.57s run time
#x1B[1m#x1B[.../api/endpoints/test_project_trace_item_details.py#x1B[0m:83: in test_simple
    assert trace_details_response.status_code == 200, trace_details_response.content
#x1B[1m#x1B[31mE   AssertionError: b'{"detail":"Internal Error","errorId":null}'#x1B[0m
#x1B[1m#x1B[31mE   assert 500 == 200#x1B[0m
#x1B[1m#x1B[31mE    +  where 500 = <Response status_code=500, "application/json">.status_code#x1B[0m

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

return Response({"detail": ERR_INSUFFICIENT_ROLE}, status=400)
else:
if not request.access.has_scope("member:admin"):
if not organization.flags.disable_member_invite and request.access.has_scope(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is taken from the old endpoint. However, does it make sense to prohibit deleting invites if member invite is disabled? I feel like users should be allowed to delete this invite objects.

@mifu67 mifu67 marked this pull request as ready for review April 8, 2025 16:38
@mifu67 mifu67 requested a review from cathteng April 8, 2025 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant