Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Clarify default-variant media-link guard comment

Łukasz Adamczyk258f83c4bccf
diff --git a/spree/core/app/jobs/spree/media/migrate_product_assets_job.rb b/spree/core/app/jobs/spree/media/migrate_product_assets_job.rb
index 7d5ad80771..865663420b 100644
--- a/spree/core/app/jobs/spree/media/migrate_product_assets_job.rb
+++ b/spree/core/app/jobs/spree/media/migrate_product_assets_job.rb
@@ -27,8 +27,10 @@ module Spree
next if asset_ids.blank?
move_assets_to_product(asset_ids, product)
- # The default variant's assets become product-level only; option
- # variants keep a VariantMedia link back to the moved asset.
+ # The default variant's assets stay product-level (no back-link). This
+ # only applies once default_variant_id is populated; during the one-time
+ # legacy migration it's still NULL (the backfill runs later in
+ # spree:remove_master_variant), so every migrated variant gets linked then.
link_assets_to_variant(asset_ids, variant.id) unless variant.id == product.default_variant_id
touched_variants << variant
end