diff --git a/src/sentry/api/endpoints/organization_minimal_projects.py b/src/sentry/api/endpoints/organization_minimal_projects.py deleted file mode 100644 index 33a1f11bf52c25..00000000000000 --- a/src/sentry/api/endpoints/organization_minimal_projects.py +++ /dev/null @@ -1,41 +0,0 @@ -from rest_framework.request import Request -from rest_framework.response import Response - -from sentry.api.api_owners import ApiOwner -from sentry.api.api_publish_status import ApiPublishStatus -from sentry.api.base import EnvironmentMixin, region_silo_endpoint -from sentry.api.bases.organization import OrganizationAndStaffPermission, OrganizationEndpoint -from sentry.api.paginator import OffsetPaginator -from sentry.api.serializers import serialize -from sentry.api.serializers.models.project import MinimalProjectSerializer -from sentry.constants import ObjectStatus -from sentry.models.project import Project - - -@region_silo_endpoint -class OrganizationMinimalProjectsEndpoint(OrganizationEndpoint, EnvironmentMixin): - # this is for the UI only - publish_status = { - "GET": ApiPublishStatus.PRIVATE, - } - permission_classes = (OrganizationAndStaffPermission,) - owner = ApiOwner.UNOWNED - - def get(self, request: Request, organization) -> Response: - """ - Return projects for an organization. Only return a subset of project fields - that are needed for rendering our application well. - """ - queryset = Project.objects.filter(organization=organization, status=ObjectStatus.ACTIVE) - - def serialize_on_result(result): - serializer = MinimalProjectSerializer() - return serialize(result, request.user, serializer) - - return self.paginate( - request=request, - queryset=queryset, - count_hits=True, - on_results=serialize_on_result, - paginator_cls=OffsetPaginator, - ) diff --git a/src/sentry/api/serializers/models/project.py b/src/sentry/api/serializers/models/project.py index cc1deacb83657c..48df8f6b779d06 100644 --- a/src/sentry/api/serializers/models/project.py +++ b/src/sentry/api/serializers/models/project.py @@ -1167,25 +1167,3 @@ def serialize(self, obj, attrs, user, **kwargs): "features": feature_list, "organization": {"slug": obj.organization.slug, "name": obj.organization.name}, } - - -class MinimalProjectSerializer(Serializer): - def get_attrs(self, item_list: Sequence[Project], user: User, **kwargs: Any): - environments_by_project = get_environments_by_projects(item_list) - memberships_by_project = get_access_by_project(item_list, user) - return { - project: { - "environments": environments_by_project[project.id], - "isMember": memberships_by_project[project]["is_member"], - } - for project in item_list - } - - def serialize(self, obj: Project, attrs: Mapping[str, Any], user: User): - return { - "slug": obj.slug, - "id": obj.id, - "platform": obj.platform, - "environments": attrs["environments"], - "isMember": attrs["isMember"], - } diff --git a/src/sentry/api/urls.py b/src/sentry/api/urls.py index 07b80cbc400aee..208d1ed34e5e53 100644 --- a/src/sentry/api/urls.py +++ b/src/sentry/api/urls.py @@ -14,7 +14,6 @@ OrganizationEventsRootCauseAnalysisEndpoint, ) from sentry.api.endpoints.organization_fork import OrganizationForkEndpoint -from sentry.api.endpoints.organization_minimal_projects import OrganizationMinimalProjectsEndpoint from sentry.api.endpoints.organization_missing_org_members import OrganizationMissingMembersEndpoint from sentry.api.endpoints.organization_plugins_configs import OrganizationPluginsConfigsEndpoint from sentry.api.endpoints.organization_plugins_index import OrganizationPluginsEndpoint @@ -1762,11 +1761,6 @@ def create_group_urls(name_prefix: str) -> list[URLPattern | URLResolver]: OrganizationProjectsEndpoint.as_view(), name="sentry-api-0-organization-projects", ), - re_path( - r"^(?P[^\/]+)/minimal-projects/$", - OrganizationMinimalProjectsEndpoint.as_view(), - name="sentry-api-0-organization-minimal-projects", - ), re_path( r"^(?P[^\/]+)/experimental/projects/$", OrganizationProjectsExperimentEndpoint.as_view(), diff --git a/src/sentry/apidocs/api_ownership_allowlist_dont_modify.py b/src/sentry/apidocs/api_ownership_allowlist_dont_modify.py index c81e3b583cef46..5c3271ad6238a7 100644 --- a/src/sentry/apidocs/api_ownership_allowlist_dont_modify.py +++ b/src/sentry/apidocs/api_ownership_allowlist_dont_modify.py @@ -51,7 +51,6 @@ "/api/0/organizations/{organization_id_or_slug}/releases/", "/api/0/organizations/{organization_id_or_slug}/releases/{version}/files/", "/api/0/projects/{organization_id_or_slug}/{project_id_or_slug}/", - "/api/0/organizations/{organization_id_or_slug}/minimal-projects/", "/api/0/projects/{organization_id_or_slug}/{project_id_or_slug}/releases/{version}/commits/", "/api/0/users/{user_id}/roles/", "/api/0/projects/{organization_id_or_slug}/{project_id_or_slug}/keys/{key_id}/", diff --git a/tests/sentry/api/endpoints/test_organization_minimal_projects.py b/tests/sentry/api/endpoints/test_organization_minimal_projects.py deleted file mode 100644 index f9b9d2291a52b6..00000000000000 --- a/tests/sentry/api/endpoints/test_organization_minimal_projects.py +++ /dev/null @@ -1,43 +0,0 @@ -from sentry.constants import ObjectStatus -from sentry.testutils.cases import APITestCase -from sentry.testutils.skips import requires_snuba - -pytestmark = [requires_snuba] - - -class OrganizationProjectsTestBase(APITestCase): - endpoint = "sentry-api-0-organization-minimal-projects" - - def test_simple(self): - self.login_as(user=self.user) - project1 = self.create_project(teams=[self.team], platform="javascript") - project2 = self.create_project(teams=[self.team], platform="python") - - self.create_environment(project=project1, name="production") - self.create_environment(project=project2, name="staging") - - response = self.get_success_response(self.organization.slug) - assert response.headers["X-Hits"] == "2" - assert sorted(response.data, key=lambda x: x["id"]) == [ - { - "environments": ["production"], - "id": project1.id, - "slug": project1.slug, - "isMember": True, - "platform": "javascript", - }, - { - "environments": ["staging"], - "id": project2.id, - "slug": project2.slug, - "isMember": True, - "platform": "python", - }, - ] - - def test_no_pending_deletion(self): - self.login_as(user=self.user) - project = self.create_project(teams=[self.team], platform="python") - project.update(status=ObjectStatus.PENDING_DELETION) - response = self.get_success_response(self.organization.slug) - assert sorted(response.data) == [] diff --git a/tests/sentry/api/test_data_secrecy.py b/tests/sentry/api/test_data_secrecy.py index ed0eb93b2c8972..329f3a8f5ac1a5 100644 --- a/tests/sentry/api/test_data_secrecy.py +++ b/tests/sentry/api/test_data_secrecy.py @@ -39,7 +39,7 @@ def test_member_has_access(self): class DataSecrecyV2TestCase(APITestCase): # Picked an endpoint with OrganizationAndStaffPermission - endpoint = "sentry-api-0-organization-minimal-projects" + endpoint = "sentry-api-0-organization-projects" method = "get" def setUp(self):