Skip to content

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

feat(shop): remove deprecated shopDomainUpdate mutation (#19471)

Lukasz Ostrowskie913572b4e91
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 648569245d..a871049ba1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,7 @@ All notable, unreleased changes to this project will be documented in this file.
- Bulk delete mutations now limit the number of `ids` per call (default 100, configurable via the `BULK_DELETE_LIMIT` env var). Exceeding the limit returns an `INVALID` error. This applies to all bulk delete mutations, including `productBulkDelete`, `productVariantBulkDelete`, `categoryBulkDelete`, `collectionBulkDelete`, `productTypeBulkDelete`, `productMediaBulkDelete`, `attributeBulkDelete`, `attributeValueBulkDelete`, `customerBulkDelete`, `staffBulkDelete`, `pageBulkDelete`, `pageTypeBulkDelete`, `menuBulkDelete`, `menuItemBulkDelete`, `giftCardBulkDelete`, `saleBulkDelete`, `voucherBulkDelete`, `promotionBulkDelete`, `shippingPriceBulkDelete`, `shippingZoneBulkDelete`, `draftOrderBulkDelete`, and `draftOrderLinesBulkDelete`.
- Removed the deprecated `checkoutId` input argument from the `checkoutShippingAddressUpdate` and `checkoutBillingAddressUpdate` mutations. Use the `id` argument instead.
- `confirmAccount()` mutation no longer allows to confirm an account that was already confirmed. - #19459 by @NyanKiyosi
+- Removed the deprecated `shopDomainUpdate` mutation. Use the `PUBLIC_URL` environment variable to configure the shop domain instead.
- Removed the deprecated `orderSettingsUpdate` mutation. Use the `channelUpdate` mutation with the `orderSettings` input to update order settings per channel instead.
- Removed the deprecated `orderSettings` query field. Use the `channel` query and read its `orderSettings` field instead.
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index 2e78b954dc..7f0e7a39a5 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -14900,7 +14900,9 @@ type Shop implements ObjectWithMetadata {
"""Shop's description."""
description: String
- """Shop's domain data."""
+ """
+ Shop's domain data. Can be customized using the `PUBLIC_URL` environment variable if self-hosted. If a custom domain is needed in your Saleor Cloud environment, then contact Saleor support.
+ """
domain: Domain!
"""List of the shops's supported languages."""
@@ -17660,16 +17662,6 @@ type Mutation {
id: ID!
): StaffNotificationRecipientDelete @doc(category: "Users")
- """
- Updates site domain of the shop.
-
- Requires one of the following permissions: MANAGE_SETTINGS.
- """
- shopDomainUpdate(
- """Fields required to update site."""
- input: SiteDomainInput
- ): ShopDomainUpdate @doc(category: "Shop") @deprecated(reason: "Use `PUBLIC_URL` environment variable instead.")
-
"""
Updates shop settings.
@@ -22991,26 +22983,6 @@ type StaffNotificationRecipientDelete @doc(category: "Users") {
staffNotificationRecipient: StaffNotificationRecipient
}
-"""
-Updates site domain of the shop.
-
-Requires one of the following permissions: MANAGE_SETTINGS.
-"""
-type ShopDomainUpdate @doc(category: "Shop") {
- """Updated shop."""
- shop: Shop
- shopErrors: [ShopError!]! @deprecated(reason: "Use `errors` field instead.")
- errors: [ShopError!]!
-}
-
-input SiteDomainInput {
- """Domain name for shop."""
- domain: String
-
- """Shop site name."""
- name: String
-}
-
"""
Updates shop settings.
diff --git a/saleor/graphql/shop/mutations/__init__.py b/saleor/graphql/shop/mutations/__init__.py
index 7fd828d73c..ec0e1b9f0d 100644
--- a/saleor/graphql/shop/mutations/__init__.py
+++ b/saleor/graphql/shop/mutations/__init__.py
@@ -4,7 +4,6 @@ from .refund_settings_update import RefundSettingsUpdate
from .return_reason_reference_type_clear import ReturnReasonReferenceTypeClear
from .return_settings_update import ReturnSettingsUpdate
from .shop_address_update import ShopAddressUpdate
-from .shop_domain_update import ShopDomainUpdate
from .shop_fetch_tax_rates import ShopFetchTaxRates
from .shop_settings_update import ShopSettingsUpdate
from .staff_notification_recipient_create import StaffNotificationRecipientCreate
@@ -18,7 +17,6 @@ __all__ = [
"ReturnSettingsUpdate",
"ReturnReasonReferenceTypeClear",
"ShopAddressUpdate",
- "ShopDomainUpdate",
"ShopFetchTaxRates",
"ShopSettingsUpdate",
"StaffNotificationRecipientCreate",
diff --git a/saleor/graphql/shop/mutations/shop_domain_update.py b/saleor/graphql/shop/mutations/shop_domain_update.py
deleted file mode 100644
index dfd314d2b3..0000000000
--- a/saleor/graphql/shop/mutations/shop_domain_update.py
+++ /dev/null
@@ -1,46 +0,0 @@
-import graphene
-
-from ....permission.enums import SitePermissions
-from ...core import ResolveInfo
-from ...core.doc_category import DOC_CATEGORY_SHOP
-from ...core.mutations import BaseMutation
-from ...core.types import ShopError
-from ...site.dataloaders import get_site_promise
-from ..types import Shop
-
-
-class SiteDomainInput(graphene.InputObjectType):
- domain = graphene.String(description="Domain name for shop.")
- name = graphene.String(description="Shop site name.")
-
- class Meta:
- doc_category = DOC_CATEGORY_SHOP
-
-
-class ShopDomainUpdate(BaseMutation):
- shop = graphene.Field(Shop, description="Updated shop.")
-
- class Arguments:
- input = SiteDomainInput(description="Fields required to update site.")
-
- class Meta:
- description = "Updates site domain of the shop."
- doc_category = DOC_CATEGORY_SHOP
- permissions = (SitePermissions.MANAGE_SETTINGS,)
- error_type_class = ShopError
- error_type_field = "shop_errors"
-
- @classmethod
- def perform_mutation( # type: ignore[override]
- cls, _root, info: ResolveInfo, /, *, input
- ):
- site = get_site_promise(info.context).get()
- domain = input.get("domain")
- name = input.get("name")
- if domain is not None:
- site.domain = domain
- if name is not None:
- site.name = name
- cls.clean_instance(info, site)
- site.save()
- return ShopDomainUpdate(shop=Shop())
diff --git a/saleor/graphql/shop/schema.py b/saleor/graphql/shop/schema.py
index a5f2db5170..3325c6f998 100644
--- a/saleor/graphql/shop/schema.py
+++ b/saleor/graphql/shop/schema.py
@@ -16,7 +16,6 @@ from .mutations import (
ReturnReasonReferenceTypeClear,
ReturnSettingsUpdate,
ShopAddressUpdate,
- ShopDomainUpdate,
ShopFetchTaxRates,
ShopSettingsUpdate,
StaffNotificationRecipientCreate,
@@ -75,9 +74,6 @@ class ShopMutations(graphene.ObjectType):
staff_notification_recipient_update = StaffNotificationRecipientUpdate.Field()
staff_notification_recipient_delete = StaffNotificationRecipientDelete.Field()
- shop_domain_update = ShopDomainUpdate.Field(
- deprecation_reason="Use `PUBLIC_URL` environment variable instead."
- )
shop_settings_update = ShopSettingsUpdate.Field()
shop_fetch_tax_rates = ShopFetchTaxRates.Field(
deprecation_reason=DEFAULT_DEPRECATION_REASON
diff --git a/saleor/graphql/shop/tests/mutations/test_shop_domain_update.py b/saleor/graphql/shop/tests/mutations/test_shop_domain_update.py
deleted file mode 100644
index 5c78e672e4..0000000000
--- a/saleor/graphql/shop/tests/mutations/test_shop_domain_update.py
+++ /dev/null
@@ -1,37 +0,0 @@
-from .....site.models import Site
-from ....tests.utils import get_graphql_content
-
-
-def test_shop_domain_update(staff_api_client, permission_manage_settings, settings):
- settings.PUBLIC_URL = None
- # given
- query = """
- mutation updateSettings($input: SiteDomainInput!) {
- shopDomainUpdate(input: $input) {
- shop {
- name
- domain {
- host,
- }
- }
- }
- }
- """
- new_name = "saleor test store"
- variables = {"input": {"domain": "lorem-ipsum.com", "name": new_name}}
- site = Site.objects.get_current()
- assert site.domain != "lorem-ipsum.com"
-
- # when
- response = staff_api_client.post_graphql(
- query, variables, permissions=[permission_manage_settings]
- )
-
- # then
- content = get_graphql_content(response)
- data = content["data"]["shopDomainUpdate"]["shop"]
- assert data["domain"]["host"] == "lorem-ipsum.com"
- assert data["name"] == new_name
- site.refresh_from_db()
- assert site.domain == "lorem-ipsum.com"
- assert site.name == new_name
diff --git a/saleor/graphql/shop/types.py b/saleor/graphql/shop/types.py
index 3c52071733..63d1bee74d 100644
--- a/saleor/graphql/shop/types.py
+++ b/saleor/graphql/shop/types.py
@@ -303,7 +303,15 @@ class Shop(graphene.ObjectType):
permissions=[SitePermissions.MANAGE_SETTINGS],
)
description = graphene.String(description="Shop's description.")
- domain = graphene.Field(Domain, required=True, description="Shop's domain data.")
+ domain = graphene.Field(
+ Domain,
+ required=True,
+ description=(
+ "Shop's domain data. Can be customized using the `PUBLIC_URL` "
+ "environment variable if self-hosted. If a custom domain is needed "
+ "in your Saleor Cloud environment, then contact Saleor support."
+ ),
+ )
languages = NonNullList(
LanguageDisplay,
description="List of the shops's supported languages.",