Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Fix appExtensions filter (#18508)
Lukasz Ostrowskiaba3c734e326
diff --git a/saleor/graphql/app/filters.py b/saleor/graphql/app/filters.pyindex da37923eff..34b69a94e1 100644--- a/saleor/graphql/app/filters.py+++ b/saleor/graphql/app/filters.py@@ -1,4 +1,5 @@import django_filters+import graphenefrom ...app import modelsfrom ...app.types import AppExtensionTarget, AppType@@ -33,7 +34,7 @@ def filter_app_extension_mount(qs, _, value):def filter_app_extension_mount_name(qs, _, value):if value:- qs = qs.filter(mount=value.lower())+ qs = qs.filter(mount__in=[v.lower() for v in value])return qs@@ -64,7 +65,8 @@ class AppExtensionFilter(django_filters.FilterSet):method=filter_app_extension_target,help_text=f"DEPRECATED: Use `targetName` instead. {DEPRECATED_IN_3X_INPUT}",)- mountName = django_filters.CharFilter(+ mountName = ListObjectTypeFilter(+ input_class=graphene.String,method=filter_app_extension_mount_name,help_text="Plain-text mount name (case insensitive)" + ADDED_IN_322,)diff --git a/saleor/graphql/app/tests/queries/test_app_extensions.py b/saleor/graphql/app/tests/queries/test_app_extensions.pyindex f686f59364..e0d9540e33 100644--- a/saleor/graphql/app/tests/queries/test_app_extensions.py+++ b/saleor/graphql/app/tests/queries/test_app_extensions.py@@ -254,30 +254,58 @@ def test_app_extensions_with_filter(({}, 4),({"targetName": "APP_PAGE"}, 1),({"targetName": "POPUP"}, 3),- ({"mountName": "PRODUCT_OVERVIEW_MORE_ACTIONS"}, 1),- ({"mountName": "PRODUCT_OVERVIEW_CREATE"}, 2),- ({"mountName": "PRODUCT_DETAILS_MORE_ACTIONS"}, 1),+ ({"mountName": ["PRODUCT_OVERVIEW_MORE_ACTIONS"]}, 1),+ ({"mountName": ["PRODUCT_OVERVIEW_CREATE"]}, 2),+ ({"mountName": ["PRODUCT_DETAILS_MORE_ACTIONS"]}, 1),+ (+ {+ "mountName": [+ "PRODUCT_OVERVIEW_CREATE",+ "PRODUCT_OVERVIEW_MORE_ACTIONS",+ ]+ },+ 3,+ ),+ (+ {+ "mountName": [+ "PRODUCT_OVERVIEW_CREATE",+ "PRODUCT_DETAILS_MORE_ACTIONS",+ ]+ },+ 3,+ ),({"targetName": "APP_PAGE",- "mountName": "PRODUCT_OVERVIEW_MORE_ACTIONS",+ "mountName": ["PRODUCT_OVERVIEW_MORE_ACTIONS"],},1,),({"targetName": "POPUP",- "mountName": "PRODUCT_OVERVIEW_CREATE",+ "mountName": ["PRODUCT_OVERVIEW_CREATE"],},2,),({"targetName": "APP_PAGE",- "mountName": "PRODUCT_DETAILS_MORE_ACTIONS",+ "mountName": ["PRODUCT_DETAILS_MORE_ACTIONS"],},0,),+ (+ {+ "targetName": "POPUP",+ "mountName": [+ "PRODUCT_OVERVIEW_CREATE",+ "PRODUCT_DETAILS_MORE_ACTIONS",+ ],+ },+ 3,+ ),],)def test_app_extensions_with_name_filter(diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphqlindex 056f510183..aa0321e324 100644--- a/saleor/graphql/schema.graphql+++ b/saleor/graphql/schema.graphql@@ -14854,7 +14854,7 @@ input AppExtensionFilterInput @doc(category: "Apps") {Added in Saleor 3.22."""- mountName: String+ mountName: [String!]"""Plain-text target name (case insensitive)