Skip to content
Closed
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
7 changes: 0 additions & 7 deletions src/sentry/api/endpoints/organization_relay_usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from rest_framework.request import Request
from rest_framework.response import Response

from sentry import features
from sentry.api.api_owners import ApiOwner
from sentry.api.api_publish_status import ApiPublishStatus
from sentry.api.base import region_silo_endpoint
Expand Down Expand Up @@ -41,13 +40,7 @@ class OrganizationRelayUsage(OrganizationEndpoint):
def get(self, request: Request, organization: Organization) -> Response:
"""
Return a list of trusted relays bound to an organization.

If the organization doesn't have Relay usage enabled it returns a 404.
"""
has_relays = features.has("organizations:relay", organization, actor=request.user)
if not has_relays:
return Response(status=404)

option_key = "sentry:trusted-relays"
trusted_relays = organization.get_option(option_key)
if trusted_relays is None or len(trusted_relays) == 0:
Expand Down
10 changes: 0 additions & 10 deletions src/sentry/core/endpoints/organization_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,16 +418,6 @@ def validate_require2FA(self, value):
return value

def validate_trustedRelays(self, value):
from sentry import features

organization = self.context["organization"]
request = self.context["request"]
has_relays = features.has("organizations:relay", organization, actor=request.user)
if not has_relays:
raise serializers.ValidationError(
"Organization does not have the relay feature enabled"
)

# make sure we don't have multiple instances of one public key
public_keys = set()
if value is not None:
Expand Down
1 change: 0 additions & 1 deletion static/app/types/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,6 @@ export type FeatureDisabledHooks = {
'feature-disabled:project-selector-all-projects': FeatureDisabledHook;
'feature-disabled:project-selector-checkbox': FeatureDisabledHook;
'feature-disabled:rate-limits': FeatureDisabledHook;
'feature-disabled:relay': FeatureDisabledHook;
'feature-disabled:replay-sidebar-item': FeatureDisabledHook;
'feature-disabled:sso-basic': FeatureDisabledHook;
'feature-disabled:sso-saml2': FeatureDisabledHook;
Expand Down
29 changes: 1 addition & 28 deletions static/app/views/settings/organizationRelay/index.tsx
Original file line number Diff line number Diff line change
@@ -1,34 +1,7 @@
import Feature from 'sentry/components/acl/feature';
import FeatureDisabled from 'sentry/components/acl/featureDisabled';
import Panel from 'sentry/components/panels/panel';
import PanelBody from 'sentry/components/panels/panelBody';
import {t} from 'sentry/locale';
import useOrganization from 'sentry/utils/useOrganization';

import {RelayWrapper} from './relayWrapper';

function OrganizationRelay() {
const organization = useOrganization();
return (
<Feature
organization={organization}
features="relay"
hookName="feature-disabled:relay"
renderDisabled={p => (
<Panel>
<PanelBody withPadding>
<FeatureDisabled
features={p.features}
hideHelpToggle
featureName={t('Relay')}
/>
</PanelBody>
</Panel>
)}
>
<RelayWrapper />
</Feature>
);
return <RelayWrapper />;
}

export default OrganizationRelay;
82 changes: 0 additions & 82 deletions static/gsApp/components/features/disabledRelay.tsx

This file was deleted.

6 changes: 0 additions & 6 deletions static/gsApp/components/labelWithPowerIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import type {Subscription} from 'getsentry/types';
import {isEnterprise} from 'getsentry/utils/billing';

const SSO = 'sso';
const RELAY = 'relay';
const ALLOCATIONS = 'allocations-upsell';
const TEAM_ROLES = 'team-roles-upsell';

Expand All @@ -37,11 +36,6 @@ const POWER_FEATURE_CONFIG = [
features: ['sso-saml2'],
partial: true,
},
{
id: RELAY,
features: ['relay'],
partial: false,
},
{
id: ALLOCATIONS,
features: ['spend-allocations'],
Expand Down
2 changes: 0 additions & 2 deletions static/gsApp/registerHooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import DisabledDataForwarding from 'getsentry/components/features/disabledDataFo
import DisabledDateRange from 'getsentry/components/features/disabledDateRange';
import DisabledDiscardGroup from 'getsentry/components/features/disabledDiscardGroup';
import DisabledRateLimits from 'getsentry/components/features/disabledRateLimits';
import DisabledRelay from 'getsentry/components/features/disabledRelay';
import DisabledSelectorItems from 'getsentry/components/features/disabledSelectorItems';
import ExploreDateRangeQueryLimitFooter from 'getsentry/components/features/exploreDateRangeQueryLimitFooter';
import InsightsDateRangeQueryLimitFooter from 'getsentry/components/features/insightsDateRangeQueryLimitFooter';
Expand Down Expand Up @@ -267,7 +266,6 @@ const GETSENTRY_HOOKS: Partial<Hooks> = {

'feature-disabled:discard-groups': p => <DisabledDiscardGroup {...p} />,
'feature-disabled:data-forwarding': p => <DisabledDataForwarding {...p} />,
'feature-disabled:relay': p => <DisabledRelay {...p} />,
'feature-disabled:rate-limits': p => <DisabledRateLimits {...p} />,
'feature-disabled:sso-basic': p => <DisabledAuthProvider {...p} />,
'feature-disabled:sso-saml2': p => <DisabledAuthProvider {...p} />,
Expand Down
10 changes: 0 additions & 10 deletions tests/sentry/api/endpoints/test_organization_relay_usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from sentry.models.relay import RelayUsage
from sentry.testutils.cases import APITestCase
from sentry.testutils.helpers import with_feature


class OrganizationRelayHistoryTest(APITestCase):
Expand Down Expand Up @@ -59,7 +58,6 @@ def setUp(self) -> None:
for relay_data in self._history_fixture():
RelayUsage.objects.create(**relay_data)

@with_feature("organizations:relay")
def _set_org_public_keys(self, public_keys):
self.login_as(user=self.user)

Expand All @@ -73,7 +71,6 @@ def _set_org_public_keys(self, public_keys):
resp = self.client.put(url, data=data)
assert resp.status_code == 200

@with_feature("organizations:relay")
def test_no_valid_public_keys(self) -> None:
"""
An organization with no valid public keys should return an
Expand All @@ -84,13 +81,6 @@ def test_no_valid_public_keys(self) -> None:
response = self.get_success_response(self.organization.slug)
assert response.data == []

@with_feature({"organizations:relay": False})
def test_endpoint_checks_feature_present(self) -> None:
self.login_as(user=self.user)
resp = self.get_response(self.organization.slug)
assert resp.status_code == 404

@with_feature("organizations:relay")
def test_only_records_for_known_public_keys_are_returned(self) -> None:
"""
Only the relay history for relays belonging to the origanization are
Expand Down
34 changes: 9 additions & 25 deletions tests/sentry/core/endpoints/test_organization_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,10 @@ def test_trusted_relays_info(self) -> None:

data = {"trustedRelays": trusted_relays}

with self.feature("organizations:relay"):
start_time = timezone.now()
self.get_success_response(self.organization.slug, method="put", **data)
end_time = timezone.now()
response = self.get_success_response(self.organization.slug)
start_time = timezone.now()
self.get_success_response(self.organization.slug, method="put", **data)
end_time = timezone.now()
response = self.get_success_response(self.organization.slug)

response_data = response.data.get("trustedRelays")

Expand Down Expand Up @@ -886,19 +885,6 @@ def test_setting_codecov_without_paid_plan_forbidden(self) -> None:
data = {"codecovAccess": True}
self.get_error_response(self.organization.slug, status_code=403, **data)

def test_setting_trusted_relays_forbidden(self) -> None:
data = {
"trustedRelays": [
{"publicKey": _VALID_RELAY_KEYS[0], "name": "name1"},
{"publicKey": _VALID_RELAY_KEYS[1], "name": "name2"},
]
}

with self.feature({"organizations:relay": False}):
response = self.get_error_response(self.organization.slug, status_code=400, **data)

assert b"feature" in response.content

def test_setting_duplicate_trusted_keys(self) -> None:
"""
Test that you cannot set duplicated keys
Expand Down Expand Up @@ -928,8 +914,7 @@ def test_setting_duplicate_trusted_keys(self) -> None:

data = {"trustedRelays": trusted_relays}

with self.feature("organizations:relay"):
response = self.get_error_response(self.organization.slug, status_code=400, **data)
response = self.get_error_response(self.organization.slug, status_code=400, **data)

response_data = response.data.get("trustedRelays")
assert response_data is not None
Expand All @@ -956,7 +941,7 @@ def test_creating_trusted_relays(self) -> None:

data = {"trustedRelays": trusted_relays}

with self.feature("organizations:relay"), outbox_runner():
with outbox_runner():
start_time = timezone.now()
response = self.get_success_response(self.organization.slug, **data)
end_time = timezone.now()
Expand Down Expand Up @@ -1040,7 +1025,7 @@ def test_modifying_trusted_relays(self) -> None:
initial_settings = {"trustedRelays": initial_trusted_relays}
changed_settings = {"trustedRelays": modified_trusted_relays}

with self.feature("organizations:relay"), outbox_runner():
with outbox_runner():
start_time = timezone.now()
self.get_success_response(self.organization.slug, **initial_settings)
after_initial = timezone.now()
Expand Down Expand Up @@ -1108,9 +1093,8 @@ def test_deleting_trusted_relays(self) -> None:
initial_settings = {"trustedRelays": initial_trusted_relays}
changed_settings: dict[str, Any] = {"trustedRelays": []}

with self.feature("organizations:relay"):
self.get_success_response(self.organization.slug, **initial_settings)
response = self.get_success_response(self.organization.slug, **changed_settings)
self.get_success_response(self.organization.slug, **initial_settings)
response = self.get_success_response(self.organization.slug, **changed_settings)

response_data = response.data.get("trustedRelays")

Expand Down
Loading