Skip to content

Commit

Permalink
fix: Hide apps with deleted configs (#19791)
Browse files Browse the repository at this point in the history
  • Loading branch information
tiina303 authored Jan 16, 2024
1 parent 137e2d1 commit d759793
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion posthog/api/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)
)
Expand Down
21 changes: 14 additions & 7 deletions posthog/api/test/__snapshots__/test_plugin.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'*/
'''
# ---
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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'*/
'''
# ---
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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'*/
'''
# ---
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d759793

Please sign in to comment.