Skip to content

Commit ad4effd

Browse files
floelsandrewshie-sentry
authored andcommitted
fix(api): Use orgRole parameter for organization member invitations (#97165)
Fix endpoint to use requested `orgRole` instead of serializer default when creating a member for the organization. Fixes GH-96708 (see issue for more details). ### Legal Boilerplate Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.
1 parent b98e576 commit ad4effd

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/sentry/api/endpoints/organization_member/index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ def post(self, request: Request, organization) -> Response:
425425
om = OrganizationMember(
426426
organization=organization,
427427
email=result["email"],
428-
role=result["role"],
428+
role=assigned_org_role,
429429
inviter_id=request.user.id,
430430
)
431431

tests/sentry/api/endpoints/test_organization_member_index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ def test_owner_invites(self) -> None:
424424
assert response.data["email"] == "eric@localhost"
425425

426426
def test_valid_for_invites(self) -> None:
427-
data = {"email": "[email protected]", "role": "manager", "teams": [self.team.slug]}
427+
data = {"email": "[email protected]", "orgRole": "manager", "teams": [self.team.slug]}
428428
with self.settings(SENTRY_ENABLE_INVITES=True), self.tasks():
429429
self.get_success_response(self.organization.slug, method="post", **data)
430430

0 commit comments

Comments
 (0)