Browse Source

ref(app-platform): Add orgSlug to redirect request (#12543)

MeredithAnya 6 years ago
parent
commit
e907c70ba2

+ 6 - 1
src/sentry/static/sentry/app/views/organizationIntegrations/sentryAppInstallations.jsx

@@ -31,12 +31,17 @@ class SentryAppInstallations extends React.Component {
   redirectUser = data => {
     const {install, app} = data;
     const {installs} = this.state;
+    const {orgId} = this.props;
 
     if (!app.redirectUrl) {
       addSuccessMessage(t(`${app.slug} successfully installed.`));
       this.setState({installs: [install, ...installs]});
     } else {
-      const queryParams = {installationId: install.uuid, code: install.code};
+      const queryParams = {
+        installationId: install.uuid,
+        code: install.code,
+        orgSlug: orgId,
+      };
       const redirectUrl = addQueryParamsToExistingUrl(app.redirectUrl, queryParams);
       window.location.assign(redirectUrl);
     }

+ 2 - 2
tests/js/spec/views/settings/organizationIntegrations/sentryAppInstallations.spec.jsx

@@ -131,7 +131,7 @@ describe('Sentry App Installations', function() {
         wrapper.instance().install(sentryApp);
         await tick();
         expect(window.location.assign).toHaveBeenCalledWith(
-          `${sentryApp.redirectUrl}?code=${install.code}&installationId=${install.uuid}`
+          `${sentryApp.redirectUrl}?code=${install.code}&installationId=${install.uuid}&orgSlug=${org.slug}`
         );
       });
 
@@ -155,7 +155,7 @@ describe('Sentry App Installations', function() {
         wrapper.instance().install(sentryAppWithQuery);
         await tick();
         expect(window.location.assign).toHaveBeenCalledWith(
-          `https://example.com/setup?code=${install.code}&hello=1&installationId=${install.uuid}`
+          `https://example.com/setup?code=${install.code}&hello=1&installationId=${install.uuid}&orgSlug=${org.slug}`
         );
       });
     });