|
@@ -4,7 +4,6 @@ from rest_framework.response import Response
|
|
|
from sentry.api.base import region_silo_endpoint
|
|
|
from sentry.api.bases.organization import OrganizationEndpoint
|
|
|
from sentry.api.serializers import serialize
|
|
|
-from sentry.models import Project
|
|
|
|
|
|
|
|
|
@region_silo_endpoint
|
|
@@ -20,17 +19,9 @@ class OrganizationProjectsSentFirstEventEndpoint(OrganizationEndpoint):
|
|
|
:pparam string organization_slug: the slug of the organization
|
|
|
containing the projects to check
|
|
|
for a first event from.
|
|
|
- :qparam boolean is_member: An optional boolean to choose to filter on
|
|
|
- projects which the user is a member of.
|
|
|
:qparam array[string] project: An optional list of project ids to filter
|
|
|
:auth: required
|
|
|
"""
|
|
|
- is_member = request.GET.get("is_member")
|
|
|
- project_ids = set(map(int, request.GET.getlist("project")))
|
|
|
- queryset = Project.objects.filter(organization=organization, first_event__isnull=False)
|
|
|
- if is_member:
|
|
|
- queryset = queryset.filter(teams__organizationmember__user_id=request.user.id)
|
|
|
- if project_ids:
|
|
|
- queryset = queryset.filter(id__in=project_ids)
|
|
|
-
|
|
|
- return Response(serialize({"sentFirstEvent": queryset.exists()}, request.user))
|
|
|
+ projects = self.get_projects(request, organization)
|
|
|
+ seen_first_event = any(p.first_event for p in projects)
|
|
|
+ return Response(serialize({"sentFirstEvent": seen_first_event}, request.user))
|