Skip to content

Commit 68541fd

Browse files
author
NisanthanNanthakumar
authored
fix(codeowners): Use user_id instead of member_id (#26099)
Objective: We are unable to add External User mappings bc the frontend is requesting with the wrong data. We are sending in the organization_member_id as user_id for the request. This causes the request to fail the Serializer's validation. This PR fixes the fronted for the modal to use the user_id for the user_id key in the POST request.
1 parent f39fa46 commit 68541fd

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

static/app/views/organizationIntegrations/integrationExternalUserMappings.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ class IntegrationExternalUserMappings extends AsyncComponent<Props, State> {
7676

7777
get sentryNames() {
7878
const {members} = this.state;
79-
return members.map(({id, email, name, ...rest}) => {
79+
return members.map(({user: {id}, email, name}) => {
8080
const label = email !== name ? `${name} - ${email}` : `${email}`;
81-
return {...rest, id, name: label, email};
81+
return {id, name: label};
8282
});
8383
}
8484

tests/acceptance/test_organization_integration_configuration_tabs.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,25 @@ def load_page(self, slug, configuration_tab=False):
3636
self.browser.wait_until_not(".loading-indicator")
3737

3838
def test_external_user_mappings(self):
39+
# create `auth_user` records to differentiate `user_id` and `organization_member_id`
40+
self.create_sentry_app()
41+
self.user2 = self.create_user("[email protected]")
42+
self.user3 = self.create_user("[email protected]")
43+
44+
self.team = self.create_team(
45+
organization=self.organization, slug="tiger-team", members=[self.user]
46+
)
47+
self.team2 = self.create_team(
48+
organization=self.organization, slug="tiger-team2", members=[self.user2]
49+
)
50+
self.team3 = self.create_team(
51+
organization=self.organization, slug="tiger-team3", members=[self.user3]
52+
)
53+
54+
self.project = self.create_project(
55+
organization=self.organization, teams=[self.team, self.team2, self.team3], slug="bengal"
56+
)
57+
3958
with self.feature(
4059
{
4160
"organizations:integrations-codeowners": True,
@@ -59,9 +78,9 @@ def test_external_user_mappings(self):
5978

6079
# Add Mapping Modal
6180
externalName = self.browser.find_element_by_name("externalName")
62-
externalName.send_keys("@admin")
81+
externalName.send_keys("user2")
6382
self.browser.click("#userId:first-child div")
64-
self.browser.click('[id="react-select-2-option-0"]')
83+
self.browser.click('[id="react-select-2-option-1"]')
6584
self.browser.snapshot("integrations - save new external user mapping")
6685

6786
# List View

0 commit comments

Comments
 (0)