Просмотр исходного кода

feat(api-idorslug): Update Subset of Monitor & Integration Endpoints and to use `organization_id_or_slug` (#70784)

A subset of changes from https://github.com/getsentry/sentry/pull/70081!
Raj Joshi 10 месяцев назад
Родитель
Сommit
64eae036c7

+ 21 - 13
src/sentry/api/endpoints/organization_unsubscribe.py

@@ -37,7 +37,7 @@ class OrganizationUnsubscribeBase(Endpoint, Generic[T]):
 
 
     object_type = "unknown"
     object_type = "unknown"
 
 
-    def fetch_instance(self, request: Request, organization_slug: str, id: int) -> T:
+    def fetch_instance(self, request: Request, organization_id_or_slug: int | str, id: int) -> T:
         raise NotImplementedError()
         raise NotImplementedError()
 
 
     def unsubscribe(self, request: Request, instance: T):
     def unsubscribe(self, request: Request, instance: T):
@@ -46,10 +46,12 @@ class OrganizationUnsubscribeBase(Endpoint, Generic[T]):
     def add_instance_data(self, data: dict[str, Any], instance: T) -> dict[str, Any]:
     def add_instance_data(self, data: dict[str, Any], instance: T) -> dict[str, Any]:
         return data
         return data
 
 
-    def get(self, request: Request, organization_slug: str, id: int, **kwargs) -> Response:
+    def get(
+        self, request: Request, organization_id_or_slug: int | str, id: int, **kwargs
+    ) -> Response:
         if not request.user_from_signed_request:
         if not request.user_from_signed_request:
             raise NotFound()
             raise NotFound()
-        instance = self.fetch_instance(request, organization_slug, id)
+        instance = self.fetch_instance(request, organization_id_or_slug, id)
         view_url = ""
         view_url = ""
         if hasattr(instance, "get_absolute_url"):
         if hasattr(instance, "get_absolute_url"):
             view_url = str(instance.get_absolute_url())
             view_url = str(instance.get_absolute_url())
@@ -65,10 +67,12 @@ class OrganizationUnsubscribeBase(Endpoint, Generic[T]):
         }
         }
         return Response(self.add_instance_data(data, instance), 200)
         return Response(self.add_instance_data(data, instance), 200)
 
 
-    def post(self, request: Request, organization_slug: str, id: int, **kwargs) -> Response:
+    def post(
+        self, request: Request, organization_id_or_slug: int | str, id: int, **kwargs
+    ) -> Response:
         if not request.user_from_signed_request:
         if not request.user_from_signed_request:
             raise NotFound()
             raise NotFound()
-        instance = self.fetch_instance(request, organization_slug, id)
+        instance = self.fetch_instance(request, organization_id_or_slug, id)
 
 
         if request.data.get("cancel"):
         if request.data.get("cancel"):
             self.unsubscribe(request, instance)
             self.unsubscribe(request, instance)
@@ -79,16 +83,18 @@ class OrganizationUnsubscribeBase(Endpoint, Generic[T]):
 class OrganizationUnsubscribeProject(OrganizationUnsubscribeBase[Project]):
 class OrganizationUnsubscribeProject(OrganizationUnsubscribeBase[Project]):
     object_type = "project"
     object_type = "project"
 
 
-    def fetch_instance(self, request: Request, organization_slug: str, id: int) -> Project:
+    def fetch_instance(
+        self, request: Request, organization_id_or_slug: int | str, id: int
+    ) -> Project:
         try:
         try:
             project = Project.objects.select_related("organization").get(id=id)
             project = Project.objects.select_related("organization").get(id=id)
         except Project.DoesNotExist:
         except Project.DoesNotExist:
             raise NotFound()
             raise NotFound()
-        if str(organization_slug).isdecimal():
-            if project.organization.id != int(organization_slug):
+        if str(organization_id_or_slug).isdecimal():
+            if project.organization.id != int(organization_id_or_slug):
                 raise NotFound()
                 raise NotFound()
         else:
         else:
-            if project.organization.slug != organization_slug:
+            if project.organization.slug != organization_id_or_slug:
                 raise NotFound()
                 raise NotFound()
         if not OrganizationMember.objects.filter(
         if not OrganizationMember.objects.filter(
             user_id=request.user.pk, organization_id=project.organization_id
             user_id=request.user.pk, organization_id=project.organization_id
@@ -115,16 +121,18 @@ class OrganizationUnsubscribeProject(OrganizationUnsubscribeBase[Project]):
 class OrganizationUnsubscribeIssue(OrganizationUnsubscribeBase[Group]):
 class OrganizationUnsubscribeIssue(OrganizationUnsubscribeBase[Group]):
     object_type = "issue"
     object_type = "issue"
 
 
-    def fetch_instance(self, request: Request, organization_slug: str, issue_id: int) -> Group:
+    def fetch_instance(
+        self, request: Request, organization_id_or_slug: int | str, issue_id: int
+    ) -> Group:
         try:
         try:
             issue = Group.objects.get_from_cache(id=issue_id)
             issue = Group.objects.get_from_cache(id=issue_id)
         except Group.DoesNotExist:
         except Group.DoesNotExist:
             raise NotFound()
             raise NotFound()
-        if str(organization_slug).isdecimal():
-            if issue.organization.id != int(organization_slug):
+        if str(organization_id_or_slug).isdecimal():
+            if issue.organization.id != int(organization_id_or_slug):
                 raise NotFound()
                 raise NotFound()
         else:
         else:
-            if issue.organization.slug != organization_slug:
+            if issue.organization.slug != organization_id_or_slug:
                 raise NotFound()
                 raise NotFound()
 
 
         if not OrganizationMember.objects.filter(
         if not OrganizationMember.objects.filter(

+ 17 - 17
src/sentry/api/urls.py

@@ -1643,47 +1643,47 @@ ORGANIZATION_URLS = [
     ),
     ),
     # Monitors
     # Monitors
     re_path(
     re_path(
-        r"^(?P<organization_slug>[^\/]+)/monitors/$",
+        r"^(?P<organization_id_or_slug>[^\/]+)/monitors/$",
         OrganizationMonitorIndexEndpoint.as_view(),
         OrganizationMonitorIndexEndpoint.as_view(),
         name="sentry-api-0-organization-monitor-index",
         name="sentry-api-0-organization-monitor-index",
     ),
     ),
     re_path(
     re_path(
-        r"^(?P<organization_slug>[^\/]+)/monitors-stats/$",
+        r"^(?P<organization_id_or_slug>[^\/]+)/monitors-stats/$",
         OrganizationMonitorIndexStatsEndpoint.as_view(),
         OrganizationMonitorIndexStatsEndpoint.as_view(),
         name="sentry-api-0-organization-monitor-index-stats",
         name="sentry-api-0-organization-monitor-index-stats",
     ),
     ),
     re_path(
     re_path(
-        r"^(?P<organization_slug>[^\/]+)/processing-errors/$",
+        r"^(?P<organization_id_or_slug>[^\/]+)/processing-errors/$",
         OrganizationMonitorProcessingErrorsIndexEndpoint.as_view(),
         OrganizationMonitorProcessingErrorsIndexEndpoint.as_view(),
         name="sentry-api-0-organization-monitor-processing-errors-index",
         name="sentry-api-0-organization-monitor-processing-errors-index",
     ),
     ),
     re_path(
     re_path(
-        r"^(?P<organization_slug>[^\/]+)/monitors-schedule-data/$",
+        r"^(?P<organization_id_or_slug>[^\/]+)/monitors-schedule-data/$",
         OrganizationMonitorScheduleSampleDataEndpoint.as_view(),
         OrganizationMonitorScheduleSampleDataEndpoint.as_view(),
         name="sentry-api-0-organization-monitors-schedule-sample-data",
         name="sentry-api-0-organization-monitors-schedule-sample-data",
     ),
     ),
     re_path(
     re_path(
-        r"^(?P<organization_slug>[^\/]+)/monitors/(?P<monitor_id_or_slug>[^\/]+)/$",
+        r"^(?P<organization_id_or_slug>[^\/]+)/monitors/(?P<monitor_id_or_slug>[^\/]+)/$",
         OrganizationMonitorDetailsEndpoint.as_view(),
         OrganizationMonitorDetailsEndpoint.as_view(),
         name="sentry-api-0-organization-monitor-details",
         name="sentry-api-0-organization-monitor-details",
     ),
     ),
     re_path(
     re_path(
-        r"^(?P<organization_slug>[^\/]+)/monitors/(?P<monitor_id_or_slug>[^\/]+)/environments/(?P<environment>[^\/]+)$",
+        r"^(?P<organization_id_or_slug>[^\/]+)/monitors/(?P<monitor_id_or_slug>[^\/]+)/environments/(?P<environment>[^\/]+)$",
         OrganizationMonitorEnvironmentDetailsEndpoint.as_view(),
         OrganizationMonitorEnvironmentDetailsEndpoint.as_view(),
         name="sentry-api-0-organization-monitor-environment-details",
         name="sentry-api-0-organization-monitor-environment-details",
     ),
     ),
     re_path(
     re_path(
-        r"^(?P<organization_slug>[^\/]+)/monitors/(?P<monitor_id_or_slug>[^\/]+)/stats/$",
+        r"^(?P<organization_id_or_slug>[^\/]+)/monitors/(?P<monitor_id_or_slug>[^\/]+)/stats/$",
         OrganizationMonitorStatsEndpoint.as_view(),
         OrganizationMonitorStatsEndpoint.as_view(),
         name="sentry-api-0-organization-monitor-stats",
         name="sentry-api-0-organization-monitor-stats",
     ),
     ),
     re_path(
     re_path(
-        r"^(?P<organization_slug>[^\/]+)/monitors/(?P<monitor_id_or_slug>[^\/]+)/checkins/$",
+        r"^(?P<organization_id_or_slug>[^\/]+)/monitors/(?P<monitor_id_or_slug>[^\/]+)/checkins/$",
         OrganizationMonitorCheckInIndexEndpoint.as_view(),
         OrganizationMonitorCheckInIndexEndpoint.as_view(),
         name="sentry-api-0-organization-monitor-check-in-index",
         name="sentry-api-0-organization-monitor-check-in-index",
     ),
     ),
     re_path(
     re_path(
-        r"^(?P<organization_slug>[^\/]+)/monitors/(?P<monitor_id_or_slug>[^\/]+)/checkins/(?P<checkin_id>[^\/]+)/attachment/$",
+        r"^(?P<organization_id_or_slug>[^\/]+)/monitors/(?P<monitor_id_or_slug>[^\/]+)/checkins/(?P<checkin_id>[^\/]+)/attachment/$",
         method_dispatch(
         method_dispatch(
             GET=OrganizationMonitorCheckInAttachmentEndpoint.as_view(),
             GET=OrganizationMonitorCheckInAttachmentEndpoint.as_view(),
             OPTIONS=OrganizationMonitorCheckInAttachmentEndpoint.as_view(),
             OPTIONS=OrganizationMonitorCheckInAttachmentEndpoint.as_view(),
@@ -2120,12 +2120,12 @@ ORGANIZATION_URLS = [
     ),
     ),
     # Unsubscribe from organization notifications
     # Unsubscribe from organization notifications
     re_path(
     re_path(
-        r"^(?P<organization_slug>[^/]+)/unsubscribe/project/(?P<id>\d+)/$",
+        r"^(?P<organization_id_or_slug>[^/]+)/unsubscribe/project/(?P<id>\d+)/$",
         OrganizationUnsubscribeProject.as_view(),
         OrganizationUnsubscribeProject.as_view(),
         name="sentry-api-0-organization-unsubscribe-project",
         name="sentry-api-0-organization-unsubscribe-project",
     ),
     ),
     re_path(
     re_path(
-        r"^(?P<organization_slug>[^/]+)/unsubscribe/issue/(?P<id>\d+)/$",
+        r"^(?P<organization_id_or_slug>[^/]+)/unsubscribe/issue/(?P<id>\d+)/$",
         OrganizationUnsubscribeIssue.as_view(),
         OrganizationUnsubscribeIssue.as_view(),
         name="sentry-api-0-organization-unsubscribe-issue",
         name="sentry-api-0-organization-unsubscribe-issue",
     ),
     ),
@@ -2743,22 +2743,22 @@ PROJECT_URLS: list[URLPattern | URLResolver] = [
         name="sentry-api-0-project-statistical-detector",
         name="sentry-api-0-project-statistical-detector",
     ),
     ),
     re_path(
     re_path(
-        r"^(?P<organization_slug>[^\/]+)/(?P<project_id_or_slug>[^\/]+)/monitors/(?P<monitor_id_or_slug>[^\/]+)/checkins/(?P<checkin_id>[^\/]+)/attachment/$",
+        r"^(?P<organization_id_or_slug>[^\/]+)/(?P<project_id_or_slug>[^\/]+)/monitors/(?P<monitor_id_or_slug>[^\/]+)/checkins/(?P<checkin_id>[^\/]+)/attachment/$",
         ProjectMonitorCheckInAttachmentEndpoint.as_view(),
         ProjectMonitorCheckInAttachmentEndpoint.as_view(),
         name="sentry-api-0-project-monitor-check-in-attachment",
         name="sentry-api-0-project-monitor-check-in-attachment",
     ),
     ),
     re_path(
     re_path(
-        r"^(?P<organization_slug>[^\/]+)/(?P<project_id_or_slug>[^\/]+)/monitors/(?P<monitor_id_or_slug>[^\/]+)/$",
+        r"^(?P<organization_id_or_slug>[^\/]+)/(?P<project_id_or_slug>[^\/]+)/monitors/(?P<monitor_id_or_slug>[^\/]+)/$",
         ProjectMonitorDetailsEndpoint.as_view(),
         ProjectMonitorDetailsEndpoint.as_view(),
         name="sentry-api-0-project-monitor-details",
         name="sentry-api-0-project-monitor-details",
     ),
     ),
     re_path(
     re_path(
-        r"^(?P<organization_slug>[^\/]+)/(?P<project_id_or_slug>[^\/]+)/monitors/(?P<monitor_id_or_slug>[^\/]+)/checkins/$",
+        r"^(?P<organization_id_or_slug>[^\/]+)/(?P<project_id_or_slug>[^\/]+)/monitors/(?P<monitor_id_or_slug>[^\/]+)/checkins/$",
         ProjectMonitorCheckInIndexEndpoint.as_view(),
         ProjectMonitorCheckInIndexEndpoint.as_view(),
         name="sentry-api-0-project-monitor-check-in-index",
         name="sentry-api-0-project-monitor-check-in-index",
     ),
     ),
     re_path(
     re_path(
-        r"^(?P<organization_slug>[^\/]+)/(?P<project_id_or_slug>[^\/]+)/monitors/(?P<monitor_id_or_slug>[^\/]+)/environments/(?P<environment>[^\/]+)$",
+        r"^(?P<organization_id_or_slug>[^\/]+)/(?P<project_id_or_slug>[^\/]+)/monitors/(?P<monitor_id_or_slug>[^\/]+)/environments/(?P<environment>[^\/]+)$",
         ProjectMonitorEnvironmentDetailsEndpoint.as_view(),
         ProjectMonitorEnvironmentDetailsEndpoint.as_view(),
         name="sentry-api-0-project-monitor-environment-details",
         name="sentry-api-0-project-monitor-environment-details",
     ),
     ),
@@ -2768,12 +2768,12 @@ PROJECT_URLS: list[URLPattern | URLResolver] = [
         name="sentry-api-0-project-processing-errors-details",
         name="sentry-api-0-project-processing-errors-details",
     ),
     ),
     re_path(
     re_path(
-        r"^(?P<organization_slug>[^\/]+)/(?P<project_id_or_slug>[^\/]+)/monitors/(?P<monitor_id_or_slug>[^\/]+)/processing-errors/$",
+        r"^(?P<organization_id_or_slug>[^\/]+)/(?P<project_id_or_slug>[^\/]+)/monitors/(?P<monitor_id_or_slug>[^\/]+)/processing-errors/$",
         ProjectMonitorProcessingErrorsIndexEndpoint.as_view(),
         ProjectMonitorProcessingErrorsIndexEndpoint.as_view(),
         name="sentry-api-0-project-monitor-processing-errors-index",
         name="sentry-api-0-project-monitor-processing-errors-index",
     ),
     ),
     re_path(
     re_path(
-        r"^(?P<organization_slug>[^\/]+)/(?P<project_id_or_slug>[^\/]+)/monitors/(?P<monitor_id_or_slug>[^\/]+)/stats/$",
+        r"^(?P<organization_id_or_slug>[^\/]+)/(?P<project_id_or_slug>[^\/]+)/monitors/(?P<monitor_id_or_slug>[^\/]+)/stats/$",
         ProjectMonitorStatsEndpoint.as_view(),
         ProjectMonitorStatsEndpoint.as_view(),
         name="sentry-api-0-project-monitor-stats",
         name="sentry-api-0-project-monitor-stats",
     ),
     ),

+ 1 - 1
src/sentry/integrations/bitbucket/urls.py

@@ -28,7 +28,7 @@ urlpatterns = [
         name="sentry-extensions-bitbucket-webhook",
         name="sentry-extensions-bitbucket-webhook",
     ),
     ),
     re_path(
     re_path(
-        r"^search/(?P<organization_slug>[^\/]+)/(?P<integration_id>\d+)/$",
+        r"^search/(?P<organization_id_or_slug>[^\/]+)/(?P<integration_id>\d+)/$",
         BitbucketSearchEndpoint.as_view(),
         BitbucketSearchEndpoint.as_view(),
         name="sentry-extensions-bitbucket-search",
         name="sentry-extensions-bitbucket-search",
     ),
     ),

+ 1 - 1
src/sentry/integrations/github/urls.py

@@ -16,7 +16,7 @@ urlpatterns = [
         name="sentry-integration-github-installation",
         name="sentry-integration-github-installation",
     ),
     ),
     re_path(
     re_path(
-        r"^search/(?P<organization_slug>[^\/]+)/(?P<integration_id>\d+)/$",
+        r"^search/(?P<organization_id_or_slug>[^\/]+)/(?P<integration_id>\d+)/$",
         GithubSharedSearchEndpoint.as_view(),
         GithubSharedSearchEndpoint.as_view(),
         name="sentry-integration-github-search",
         name="sentry-integration-github-search",
     ),
     ),

+ 1 - 1
src/sentry/integrations/gitlab/urls.py

@@ -5,7 +5,7 @@ from .webhooks import GitlabWebhookEndpoint
 
 
 urlpatterns = [
 urlpatterns = [
     re_path(
     re_path(
-        r"^search/(?P<organization_slug>[^\/]+)/(?P<integration_id>\d+)/$",
+        r"^search/(?P<organization_id_or_slug>[^\/]+)/(?P<integration_id>\d+)/$",
         GitlabIssueSearchEndpoint.as_view(),
         GitlabIssueSearchEndpoint.as_view(),
         name="sentry-extensions-gitlab-search",
         name="sentry-extensions-gitlab-search",
     ),
     ),

+ 1 - 1
src/sentry/integrations/jira/urls.py

@@ -39,7 +39,7 @@ urlpatterns = [
         name="sentry-extensions-jira-issue-updated",
         name="sentry-extensions-jira-issue-updated",
     ),
     ),
     re_path(
     re_path(
-        r"^search/(?P<organization_slug>[^\/]+)/(?P<integration_id>\d+)/$",
+        r"^search/(?P<organization_id_or_slug>[^\/]+)/(?P<integration_id>\d+)/$",
         JiraSearchEndpoint.as_view(),
         JiraSearchEndpoint.as_view(),
         name="sentry-extensions-jira-search",
         name="sentry-extensions-jira-search",
     ),
     ),

+ 1 - 1
src/sentry/integrations/jira_server/urls.py

@@ -11,7 +11,7 @@ urlpatterns = [
         name="sentry-extensions-jiraserver-issue-updated",
         name="sentry-extensions-jiraserver-issue-updated",
     ),
     ),
     re_path(
     re_path(
-        r"^search/(?P<organization_slug>[^\/]+)/(?P<integration_id>\d+)/$",
+        r"^search/(?P<organization_id_or_slug>[^\/]+)/(?P<integration_id>\d+)/$",
         JiraServerSearchEndpoint.as_view(),
         JiraServerSearchEndpoint.as_view(),
         name="sentry-extensions-jiraserver-search",
         name="sentry-extensions-jiraserver-search",
     ),
     ),

+ 1 - 1
src/sentry/integrations/vsts/urls.py

@@ -12,7 +12,7 @@ urlpatterns = [
         name="sentry-extensions-vsts-issue-updated",
         name="sentry-extensions-vsts-issue-updated",
     ),
     ),
     re_path(
     re_path(
-        r"^search/(?P<organization_slug>[^\/]+)/(?P<integration_id>\d+)/$",
+        r"^search/(?P<organization_id_or_slug>[^\/]+)/(?P<integration_id>\d+)/$",
         VstsSearchEndpoint.as_view(),
         VstsSearchEndpoint.as_view(),
         name="sentry-extensions-vsts-search",
         name="sentry-extensions-vsts-search",
     ),
     ),

+ 5 - 5
src/sentry/monitors/endpoints/base.py

@@ -57,7 +57,7 @@ class MonitorEndpoint(Endpoint):
     def convert_args(
     def convert_args(
         self,
         self,
         request: Request,
         request: Request,
-        organization_slug: str,
+        organization_id_or_slug: int | str,
         monitor_id_or_slug: int | str,
         monitor_id_or_slug: int | str,
         environment: str | None = None,
         environment: str | None = None,
         checkin_id: str | None = None,
         checkin_id: str | None = None,
@@ -67,13 +67,13 @@ class MonitorEndpoint(Endpoint):
         try:
         try:
             if (
             if (
                 id_or_slug_path_params_enabled(
                 id_or_slug_path_params_enabled(
-                    self.convert_args.__qualname__, str(organization_slug)
+                    self.convert_args.__qualname__, str(organization_id_or_slug)
                 )
                 )
-                and str(organization_slug).isdigit()
+                and str(organization_id_or_slug).isdigit()
             ):
             ):
-                organization = Organization.objects.get_from_cache(id=organization_slug)
+                organization = Organization.objects.get_from_cache(id=organization_id_or_slug)
             else:
             else:
-                organization = Organization.objects.get_from_cache(slug=organization_slug)
+                organization = Organization.objects.get_from_cache(slug=organization_id_or_slug)
         except Organization.DoesNotExist:
         except Organization.DoesNotExist:
             raise ResourceDoesNotExist
             raise ResourceDoesNotExist
 
 

+ 19 - 15
src/sentry/monitors/endpoints/monitor_ingest_checkin_attachment.py

@@ -60,7 +60,7 @@ class MonitorIngestCheckinAttachmentEndpoint(Endpoint):
         request: Request,
         request: Request,
         monitor_id_or_slug: int | str,
         monitor_id_or_slug: int | str,
         checkin_id: str,
         checkin_id: str,
-        organization_slug: str | int | None = None,
+        organization_id_or_slug: int | str | None = None,
         *args,
         *args,
         **kwargs,
         **kwargs,
     ):
     ):
@@ -83,24 +83,28 @@ class MonitorIngestCheckinAttachmentEndpoint(Endpoint):
                 raise ResourceDoesNotExist
                 raise ResourceDoesNotExist
         else:
         else:
 
 
-            # When using DSN auth we're able to infer the organization slug
-            if not organization_slug and using_dsn_auth:
-                organization_slug = request.auth.project.organization.slug
+            # When using DSN auth we're able to infer the organization slug (organization_id_or_slug is slug in this case)
+            if not organization_id_or_slug and using_dsn_auth:
+                organization_id_or_slug = request.auth.project.organization.slug
 
 
-            # The only monitor endpoints that do not have the org slug in their
+            # The only monitor endpoints that do not have the org id or slug in their
             # parameters are the GUID-style checkin endpoints
             # parameters are the GUID-style checkin endpoints
-            if organization_slug:
+            if organization_id_or_slug:
                 try:
                 try:
-                    # Try lookup by slug first. This requires organization context.
+                    # Try lookup by id or slug first. This requires organization context.
                     if (
                     if (
                         id_or_slug_path_params_enabled(
                         id_or_slug_path_params_enabled(
-                            self.convert_args.__qualname__, str(organization_slug)
+                            self.convert_args.__qualname__, str(organization_id_or_slug)
                         )
                         )
-                        and str(organization_slug).isdecimal()
+                        and str(organization_id_or_slug).isdecimal()
                     ):
                     ):
-                        organization = Organization.objects.get_from_cache(id=organization_slug)
+                        organization = Organization.objects.get_from_cache(
+                            id=organization_id_or_slug
+                        )
                     else:
                     else:
-                        organization = Organization.objects.get_from_cache(slug=organization_slug)
+                        organization = Organization.objects.get_from_cache(
+                            slug=organization_id_or_slug
+                        )
 
 
                     monitor = get_monitor_by_org_id_or_slug(organization, monitor_id_or_slug)
                     monitor = get_monitor_by_org_id_or_slug(organization, monitor_id_or_slug)
                 except (Organization.DoesNotExist, Monitor.DoesNotExist):
                 except (Organization.DoesNotExist, Monitor.DoesNotExist):
@@ -140,12 +144,12 @@ class MonitorIngestCheckinAttachmentEndpoint(Endpoint):
         # When looking up via GUID we do not check the organization slug,
         # When looking up via GUID we do not check the organization slug,
         # validate that the slug matches the org of the monitors project
         # validate that the slug matches the org of the monitors project
 
 
-        # We only raise if the organization_slug was set and it doesn't match.
+        # We only raise if the organization_id_or_slug was set and it doesn't match.
         # We don't check the api.id-or-slug-enabled option here because slug and id are unique
         # We don't check the api.id-or-slug-enabled option here because slug and id are unique
         if (
         if (
-            organization_slug
-            and project.organization.slug != organization_slug
-            and project.organization.id != organization_slug
+            organization_id_or_slug
+            and project.organization.slug != organization_id_or_slug
+            and project.organization.id != organization_id_or_slug
         ):
         ):
             raise ResourceDoesNotExist
             raise ResourceDoesNotExist
 
 

Некоторые файлы не были показаны из-за большого количества измененных файлов