Skip to content
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
2 changes: 0 additions & 2 deletions src/sentry/features/temporary.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,6 @@ def register_temporary_features(manager: FeatureManager) -> None:
manager.add("organizations:sentry-app-webhook-circuit-breaker", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
# Override dry-run to enable real blocking per app-owner org during rollout
manager.add("organizations:sentry-app-webhook-circuit-breaker-live-run", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
# Create organiations via control-scoped domains in saas.
manager.add("organizations:create-org-control", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)

# Enables organization access to the new notification platform
manager.add("organizations:notification-platform.internal-testing", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
Expand Down
4 changes: 0 additions & 4 deletions src/sentry/web/client_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,6 @@ def enabled_features(self) -> Iterable[str]:
yield "relocation:enabled"
if features.has("system:multi-region"):
yield "system:multi-region"
if self.last_org and features.has(
"organizations:create-org-control", self.last_org, actor=self.user
):
yield "organizations:create-org-control"

@property
def needs_upgrade(self) -> bool:
Expand Down
9 changes: 0 additions & 9 deletions static/app/utils/regions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,6 @@ export function getRegionNameChoices(): Array<[string, string]> {
});
}

export function getRegionUrl(name: string): string | null {
const regions = getRegions();
const found = regions.find(item => item.name === name);
if (found) {
return found.url;
}
return null;
}

export function shouldDisplayRegions(): boolean {
return getRegions().length > 1;
}
27 changes: 13 additions & 14 deletions static/app/views/organizationCreate/index.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ describe('OrganizationCreate', () => {
it('creates a new org', async () => {
const orgCreateMock = MockApiClient.addMockResponse({
url: '/organizations/',
host: ConfigStore.get('links').sentryUrl,
method: 'POST',
body: OrganizationFixture(),
});
Expand Down Expand Up @@ -84,7 +85,7 @@ describe('OrganizationCreate', () => {
error: expect.any(Function),
method: 'POST',
data: {agreeTerms: true, defaultTeam: true, name: 'Good Burger'},
host: undefined,
host: ConfigStore.get('links').sentryUrl,
});
});
expect(testableWindowLocation.assign).toHaveBeenCalledTimes(1);
Expand All @@ -95,6 +96,7 @@ describe('OrganizationCreate', () => {

it('creates a new org with customer domain feature', async () => {
const orgCreateMock = MockApiClient.addMockResponse({
host: ConfigStore.get('links').sentryUrl,
url: '/organizations/',
method: 'POST',
body: OrganizationFixture(),
Expand All @@ -119,7 +121,7 @@ describe('OrganizationCreate', () => {
method: 'POST',
success: expect.any(Function),
error: expect.any(Function),
host: undefined,
host: ConfigStore.get('links').sentryUrl,
});
});

Expand All @@ -131,6 +133,7 @@ describe('OrganizationCreate', () => {

function multiRegionSetup() {
const orgCreateMock = MockApiClient.addMockResponse({
host: ConfigStore.get('links').sentryUrl,
url: '/organizations/',
method: 'POST',
body: OrganizationFixture(),
Expand Down Expand Up @@ -163,7 +166,7 @@ describe('OrganizationCreate', () => {
success: expect.any(Function),
error: expect.any(Function),
method: 'POST',
host: undefined,
host: ConfigStore.get('links').sentryUrl,
data: {defaultTeam: true, name: 'Good Burger'},
});
});
Expand Down Expand Up @@ -195,14 +198,13 @@ describe('OrganizationCreate', () => {
);
await userEvent.click(screen.getByText('Create Organization'));

const expectedHost = 'https://us.example.com';
await waitFor(() => {
expect(orgCreateMock).toHaveBeenCalledWith('/organizations/', {
success: expect.any(Function),
error: expect.any(Function),
method: 'POST',
host: expectedHost,
data: {defaultTeam: true, name: 'Good Burger'},
host: ConfigStore.get('links').sentryUrl,
data: {defaultTeam: true, name: 'Good Burger', dataStorageLocation: 'us'},
});
});

Expand All @@ -228,14 +230,13 @@ describe('OrganizationCreate', () => {
);
await userEvent.click(screen.getByText('Create Organization'));

const expectedHost = 'https://de.example.com';
await waitFor(() => {
expect(orgCreateMock).toHaveBeenCalledWith('/organizations/', {
success: expect.any(Function),
error: expect.any(Function),
method: 'POST',
host: expectedHost,
data: {defaultTeam: true, name: 'Good Burger'},
host: ConfigStore.get('links').sentryUrl,
data: {defaultTeam: true, name: 'Good Burger', dataStorageLocation: 'de'},
});
});

Expand All @@ -245,11 +246,8 @@ describe('OrganizationCreate', () => {
);
});

it('submits to the control URL when create-org-control is active', async () => {
ConfigStore.set(
'features',
new Set(['system:multi-region', 'organizations:create-org-control'])
);
it('submits to the control URL when multi-region is active', async () => {
ConfigStore.set('features', new Set(['system:multi-region']));
ConfigStore.set('urlPrefix', 'https://sentry.io');
ConfigStore.set('regions', [
{url: 'https://us.example.com', name: 'us'},
Expand All @@ -259,6 +257,7 @@ describe('OrganizationCreate', () => {
},
]);
const orgCreateMock = MockApiClient.addMockResponse({
host: ConfigStore.get('links').sentryUrl,
url: '/organizations/',
method: 'POST',
body: OrganizationFixture(),
Expand Down
29 changes: 3 additions & 26 deletions static/app/views/organizationCreate/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,14 @@ import {t, tct} from 'sentry/locale';
import {getOverride} from 'sentry/overrideRegistry';
import {ConfigStore} from 'sentry/stores/configStore';
import type {OrganizationSummary} from 'sentry/types/organization';
import {
getRegionUrl,
getRegionNameChoices,
shouldDisplayRegions,
} from 'sentry/utils/regions';
import {getRegionNameChoices, shouldDisplayRegions} from 'sentry/utils/regions';
import {testableWindowLocation} from 'sentry/utils/testableWindowLocation';
import {normalizeUrl} from 'sentry/utils/url/normalizeUrl';
import {useApi} from 'sentry/utils/useApi';

export const DATA_STORAGE_DOCS_LINK =
'https://docs.sentry.io/product/accounts/choose-your-data-center';

function removeDataStorageLocationFromFormData(
formData: Record<string, any>
): Record<string, any> {
const shallowFormDataClone = {...formData};
delete shallowFormDataClone.dataStorageLocation;
return shallowFormDataClone;
}

const DataConsentCheck = OverrideOrDefault({
overrideName: 'component:data-consent-org-creation-checkbox',
defaultComponent: null,
Expand All @@ -48,7 +36,6 @@ function OrganizationCreate() {
const relocationUrl = normalizeUrl('/relocation/');
const regionChoices = getRegionNameChoices();
const client = useApi();
const useControl = ConfigStore.get('features').has('organizations:create-org-control');

const hasDataConsent =
getOverride('component:data-consent-org-creation-checkbox') !== undefined;
Expand All @@ -61,17 +48,7 @@ function OrganizationCreate() {
if (!formModel.validateForm()) {
return;
}

let host: string | undefined;
if (data.dataStorageLocation) {
if (useControl) {
host = ConfigStore.get('links').sentryUrl;
} else {
const storageLocation = data.dataStorageLocation;
host = getRegionUrl(storageLocation) ?? host;
data = removeDataStorageLocationFromFormData(data);
}
}
const host = ConfigStore.get('links').sentryUrl;

addLoadingMessage(t('Creating Organization\u2026'));
formModel.setFormSaving();
Expand All @@ -84,7 +61,7 @@ function OrganizationCreate() {
error: onSubmitError,
});
},
[client, useControl]
[client]
);

return (
Expand Down
21 changes: 11 additions & 10 deletions tests/acceptance/test_create_organization.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ def setUp(self) -> None:
PRIVACY_URL="https://sentry.io/privacy/", TERMS_URL="https://sentry.io/terms/"
)
def test_simple(self) -> None:
self.browser.get("/organizations/new/")
assert self.browser.wait_until('input[name="name"]')
assert self.browser.element_exists('input[name="name"]')
assert self.browser.element_exists('input[name="agreeTerms"]')
self.browser.element('input[name="name"]').send_keys("new org")
self.browser.element('input[name="agreeTerms"]').click()
self.browser.click('button[type="submit"]')
# After creating an org should end up on create project
self.browser.wait_until_test_id("platform-javascript-react")
assert self.browser.element_exists_by_test_id("create-project")
with self.options({"system.url-prefix": self.browser.live_server_url}):
self.browser.get("/organizations/new/")
assert self.browser.wait_until('input[name="name"]')
assert self.browser.element_exists('input[name="name"]')
assert self.browser.element_exists('input[name="agreeTerms"]')
self.browser.element('input[name="name"]').send_keys("new org")
self.browser.element('input[name="agreeTerms"]').click()
self.browser.click('button[type="submit"]')
# After creating an org should end up on create project
self.browser.wait_until_test_id("platform-javascript-react")
assert self.browser.element_exists_by_test_id("create-project")
19 changes: 10 additions & 9 deletions tests/acceptance/test_quick_start.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,20 @@ def setUp(self) -> None:
PRIVACY_URL="https://sentry.io/privacy/", TERMS_URL="https://sentry.io/terms/"
)
def test_quick_start_sidebar_is_not_automatically_opened_after_project_creation(self) -> None:
self.browser.get("/organizations/new/")
with self.options({"system.url-prefix": self.browser.live_server_url}):
self.browser.get("/organizations/new/")

self.browser.element('input[name="name"]').send_keys("new org")
self.browser.element('input[name="agreeTerms"]').click()
self.browser.click('button[type="submit"]')
self.browser.element('input[name="name"]').send_keys("new org")
self.browser.element('input[name="agreeTerms"]').click()
self.browser.click('button[type="submit"]')

self.browser.wait_until_test_id("platform-javascript-react")
self.browser.click('[data-test-id="platform-javascript-react"')
self.browser.click('button[aria-label="Create Project"]')
self.browser.wait_until_test_id("platform-javascript-react")
self.browser.click('[data-test-id="platform-javascript-react"')
self.browser.click('button[aria-label="Create Project"]')

self.browser.wait_until(xpath='//h2[text()="Configure React SDK"]')
self.browser.wait_until(xpath='//h2[text()="Configure React SDK"]')

assert not self.browser.element_exists_by_test_id("quick-start-content")
assert not self.browser.element_exists_by_test_id("quick-start-content")

@pytest.mark.skip(reason="Temporarily skipped")
@with_feature("organizations:onboarding")
Expand Down
2 changes: 0 additions & 2 deletions tests/sentry/web/test_client_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ def test_client_config_features() -> None:
{
"auth:register": True,
"system:multi-region": True,
"organizations:create-org-control": True,
}
),
):
Expand All @@ -154,7 +153,6 @@ def test_client_config_features() -> None:
assert "features" in result
assert "system:multi-region" in result["features"]
assert "auth:register" in result["features"]
assert "organizations:create-org-control" in result["features"]


@no_silo_test
Expand Down
Loading