Skip to content

Saleor Core: the high performance, composable, headless commerce API.

assign size 255 by default in resolve_thumbnail functions

Burak Ozdemir6f02ca50552b
diff --git a/saleor/graphql/order/types.py b/saleor/graphql/order/types.py
index 2fe6c3b77e..ac842d962d 100644
--- a/saleor/graphql/order/types.py
+++ b/saleor/graphql/order/types.py
@@ -228,13 +228,11 @@ class OrderLine(CountableDjangoObjectType):
@gql_optimizer.resolver_hints(
prefetch_related=["variant__images", "variant__product__images"]
)
- def resolve_thumbnail(root: models.OrderLine, info, *, size=None):
+ def resolve_thumbnail(root: models.OrderLine, info, *, size=255):
if not root.variant_id:
return None
image = root.variant.get_first_image()
if image:
- if not size:
- size = 255
url = get_product_image_thumbnail(image, size, method="thumbnail")
alt = image.alt
return Image(alt=alt, url=info.context.build_absolute_uri(url))
diff --git a/saleor/graphql/product/types/products.py b/saleor/graphql/product/types/products.py
index 81583084a9..907c65a019 100644
--- a/saleor/graphql/product/types/products.py
+++ b/saleor/graphql/product/types/products.py
@@ -512,11 +512,9 @@ class Product(CountableDjangoObjectType, MetadataObjectType):
@staticmethod
@gql_optimizer.resolver_hints(prefetch_related="images")
- def resolve_thumbnail(root: models.Product, info, *, size=None):
+ def resolve_thumbnail(root: models.Product, info, *, size=255):
image = root.get_first_image()
if image:
- if not size:
- size = 255
url = get_product_image_thumbnail(image, size, method="thumbnail")
alt = image.alt
return Image(alt=alt, url=info.context.build_absolute_uri(url))