Skip to content

Commit

Permalink
Fix product created event on bulk product create main (saleor#12605)
Browse files Browse the repository at this point in the history
* Fix sending product_created in ProductBulkCreate mutation

* Fix sending product_created in ProductBulkCreate mutation

* Update CHANGELOG.md

* Check object type sent to product_create
  • Loading branch information
szdrasiak authored Apr 21, 2023
1 parent f4b5c27 commit 83f7e83
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ All notable, unreleased changes to this project will be documented in this file.
- Fix saving `description_plaintext` for product - #12586 by @SzymJ

- Remove default `EMAIL_URL` value pointing to console output; from now on EMAIL_URL has to be set explicitly - #12580 by @maarcingebala
- Fix sending `product_created` event in `ProductBulkCreate` mutation - #12605 by @SzymJ


# 3.13.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ def prepare_media(cls, info, product, media_inputs, media_to_create):
def post_save_actions(cls, info, products, variants, channels):
manager = get_plugin_manager_promise(info.context).get()
for product in products:
cls.call_event(manager.product_created, product)
cls.call_event(manager.product_created, product.node)

for variant in variants:
cls.call_event(manager.product_variant_created, variant)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ def test_product_bulk_create_send_product_created_webhook(
assert not data["results"][1]["errors"]
assert data["count"] == 2
assert created_webhook_mock.call_count == 2
for call in created_webhook_mock.call_args_list:
assert isinstance(call.args[0], Product)


def test_product_bulk_create_with_same_name_and_no_slug(
Expand Down

0 comments on commit 83f7e83

Please sign in to comment.