diff --git a/posthog/api/plugin.py b/posthog/api/plugin.py index a64c233b2daa5..393719411e8eb 100644 --- a/posthog/api/plugin.py +++ b/posthog/api/plugin.py @@ -340,7 +340,7 @@ def filter_queryset_by_parents_lookups(self, queryset): | Q(is_global=True) | Q( id__in=PluginConfig.objects.filter( # If a config exists the org can see the plugin - team__organization_id=self.organization_id + team__organization_id=self.organization_id, deleted=False ).values_list("plugin_id", flat=True) ) ) diff --git a/posthog/api/test/__snapshots__/test_plugin.ambr b/posthog/api/test/__snapshots__/test_plugin.ambr index fdb247349265e..cbc8481cb0673 100644 --- a/posthog/api/test/__snapshots__/test_plugin.ambr +++ b/posthog/api/test/__snapshots__/test_plugin.ambr @@ -64,7 +64,8 @@ (SELECT U0."plugin_id" FROM "posthog_pluginconfig" U0 INNER JOIN "posthog_team" U1 ON (U0."team_id" = U1."id") - WHERE U1."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid)) /*controller='organization_plugins-list',route='api/organizations/%28%3FP%3Cparent_lookup_organization_id%3E%5B%5E/.%5D%2B%29/plugins/%3F%24'*/ + WHERE (NOT U0."deleted" + AND U1."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid))) /*controller='organization_plugins-list',route='api/organizations/%28%3FP%3Cparent_lookup_organization_id%3E%5B%5E/.%5D%2B%29/plugins/%3F%24'*/ ''' # --- # name: TestPluginAPI.test_listing_plugins_is_not_nplus1.11 @@ -119,7 +120,8 @@ (SELECT U0."plugin_id" FROM "posthog_pluginconfig" U0 INNER JOIN "posthog_team" U1 ON (U0."team_id" = U1."id") - WHERE U1."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid)) + WHERE (NOT U0."deleted" + AND U1."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid))) LIMIT 100 /*controller='organization_plugins-list',route='api/organizations/%28%3FP%3Cparent_lookup_organization_id%3E%5B%5E/.%5D%2B%29/plugins/%3F%24'*/ ''' # --- @@ -221,7 +223,8 @@ (SELECT U0."plugin_id" FROM "posthog_pluginconfig" U0 INNER JOIN "posthog_team" U1 ON (U0."team_id" = U1."id") - WHERE U1."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid)) /*controller='organization_plugins-list',route='api/organizations/%28%3FP%3Cparent_lookup_organization_id%3E%5B%5E/.%5D%2B%29/plugins/%3F%24'*/ + WHERE (NOT U0."deleted" + AND U1."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid))) /*controller='organization_plugins-list',route='api/organizations/%28%3FP%3Cparent_lookup_organization_id%3E%5B%5E/.%5D%2B%29/plugins/%3F%24'*/ ''' # --- # name: TestPluginAPI.test_listing_plugins_is_not_nplus1.17 @@ -276,7 +279,8 @@ (SELECT U0."plugin_id" FROM "posthog_pluginconfig" U0 INNER JOIN "posthog_team" U1 ON (U0."team_id" = U1."id") - WHERE U1."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid)) + WHERE (NOT U0."deleted" + AND U1."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid))) LIMIT 100 /*controller='organization_plugins-list',route='api/organizations/%28%3FP%3Cparent_lookup_organization_id%3E%5B%5E/.%5D%2B%29/plugins/%3F%24'*/ ''' # --- @@ -402,7 +406,8 @@ (SELECT U0."plugin_id" FROM "posthog_pluginconfig" U0 INNER JOIN "posthog_team" U1 ON (U0."team_id" = U1."id") - WHERE U1."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid)) /*controller='organization_plugins-list',route='api/organizations/%28%3FP%3Cparent_lookup_organization_id%3E%5B%5E/.%5D%2B%29/plugins/%3F%24'*/ + WHERE (NOT U0."deleted" + AND U1."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid))) /*controller='organization_plugins-list',route='api/organizations/%28%3FP%3Cparent_lookup_organization_id%3E%5B%5E/.%5D%2B%29/plugins/%3F%24'*/ ''' # --- # name: TestPluginAPI.test_listing_plugins_is_not_nplus1.23 @@ -457,7 +462,8 @@ (SELECT U0."plugin_id" FROM "posthog_pluginconfig" U0 INNER JOIN "posthog_team" U1 ON (U0."team_id" = U1."id") - WHERE U1."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid)) + WHERE (NOT U0."deleted" + AND U1."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid))) LIMIT 100 /*controller='organization_plugins-list',route='api/organizations/%28%3FP%3Cparent_lookup_organization_id%3E%5B%5E/.%5D%2B%29/plugins/%3F%24'*/ ''' # --- @@ -491,7 +497,8 @@ (SELECT U0."plugin_id" FROM "posthog_pluginconfig" U0 INNER JOIN "posthog_team" U1 ON (U0."team_id" = U1."id") - WHERE U1."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid)) /*controller='organization_plugins-list',route='api/organizations/%28%3FP%3Cparent_lookup_organization_id%3E%5B%5E/.%5D%2B%29/plugins/%3F%24'*/ + WHERE (NOT U0."deleted" + AND U1."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid))) /*controller='organization_plugins-list',route='api/organizations/%28%3FP%3Cparent_lookup_organization_id%3E%5B%5E/.%5D%2B%29/plugins/%3F%24'*/ ''' # --- # name: TestPluginAPI.test_listing_plugins_is_not_nplus1.6