Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix - Customer emails are not being sent from admin if customer is from store "0" #26293

Merged
merged 6 commits into from
Apr 18, 2020
Merged

Conversation

matheusgontijo
Copy link
Contributor

Description (*)

Emails are not being sent to customers assigned to store id "0". Actually, store id "0", in the following context should be considered as a valid store id, since it's "admin". The if conditions should be actually checking if the store id is null: if ($storeId === null) { instead of if (!$storeId) {.

Manual testing scenarios (*)

In order to reproduce the issue:

  • Create a customer from admin (then customer will have store_id = 0)
  • Go to customer edit page on admin and try to click Reset Password
  • The email will not get and will throw an error.

… assiged to store "0". "0" should be considered a valid store id
@m2-assistant
Copy link

m2-assistant bot commented Jan 7, 2020

Hi @matheusgontijo. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Guide documentation.

@nuzil nuzil self-assigned this Jan 7, 2020
@nuzil
Copy link
Contributor

nuzil commented Jan 7, 2020

@magento give me 2.4-develop instance

@magento-engcom-team
Copy link
Contributor

Hi @nuzil. Thank you for your request. I'm working on Magento 2.4-develop instance for you

@magento-engcom-team
Copy link
Contributor

Hi @nuzil, here is your Magento instance.
Admin access: https://i-26293-2-4-develop.instances.magento-community.engineering/admin
Login: admin Password: 123123q
Instance will be terminated in up to 3 hours.

@nuzil
Copy link
Contributor

nuzil commented Jan 7, 2020

On Vanilla 2.4 Magento I cannot create customer with Admin scope

Screen Shot 2020-01-07 at 17 09 27

@matheusgontijo
Copy link
Contributor Author

Anyways, let consider we created a customer programmatically through an integration, and the customer was assigned to store id 0 to be globally used among several stores. This customer will not receive any email notifications.

Copy link
Contributor

@nuzil nuzil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, by the core logic it's possible to have such behaviour.
But I will ask you to change this types:
https://github.com/magento/magento2/pull/26293/files#diff-216320d539f904af6160bad485978341L365

Cause your implementation is assume that storeId can be also null.

@matheusgontijo
Copy link
Contributor Author

there we go @nuzil — modification done!

Could we merge now? Thank you!

@nuzil
Copy link
Contributor

nuzil commented Mar 23, 2020

Hi @matheusgontijo can you please cover with tests your changes?

@magento-engcom-team magento-engcom-team added this to Changes Requested in Pull Requests Dashboard Mar 24, 2020
@engcom-Echo engcom-Echo self-assigned this Apr 6, 2020
@engcom-Echo
Copy link
Contributor

I will take care of test coverage.

@nuzil
Copy link
Contributor

nuzil commented Apr 8, 2020

@magento run all tests

@nuzil
Copy link
Contributor

nuzil commented Apr 14, 2020

@engcom-Echo can you please merge 2.4 one more time?

… matheusgontijo-2.4-develop

� Conflicts:
�	app/code/Magento/Customer/Test/Unit/Model/EmailNotificationTest.php
@engcom-Echo
Copy link
Contributor

@magento run all tests

@ghost ghost moved this from Changes Requested to Ready for Testing in Pull Requests Dashboard Apr 16, 2020
@nuzil nuzil added the Auto-Tests: Covered All changes in Pull Request is covered by auto-tests label Apr 16, 2020
@magento-engcom-team
Copy link
Contributor

Hi @nuzil, thank you for the review.
ENGCOM-7445 has been created to process this Pull Request

@engcom-Alfa engcom-Alfa self-assigned this Apr 17, 2020
@engcom-Alfa engcom-Alfa moved this from Ready for Testing to Testing in Progress in Pull Requests Dashboard Apr 17, 2020
@engcom-Alfa
Copy link
Contributor

✔️ QA Passed

Manual testing scenario:

  1. Programmatically create a new customer (test user for ex.) (will have store_id = 0)
    screenshot23;

  2. Go to Admin -> Customers -> All Customers;

  3. Click on edit link for created before customer;

  4. Click on Reset Password button;

Before:
✖️ an error has been occured
Screenshot from 2020-04-17 12-42-19

After:
✔️ The password reset email was sent
Screenshot from 2020-04-17 13-23-30
Screenshot from 2020-04-17 13-36-23

@engcom-Alfa engcom-Alfa moved this from Testing in Progress to Extended Testing (optional) in Pull Requests Dashboard Apr 17, 2020
@engcom-Echo engcom-Echo moved this from Extended Testing (optional) to Merge in Progress in Pull Requests Dashboard Apr 17, 2020
@lenaorobei lenaorobei added this to the 2.4.0 milestone Apr 17, 2020
@lenaorobei lenaorobei added Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Severity: S1 Affects critical data or functionality and forces users to employ a workaround. labels Apr 17, 2020
magento-engcom-team pushed a commit that referenced this pull request Apr 18, 2020
@magento-engcom-team magento-engcom-team merged commit 6016b94 into magento:2.4-develop Apr 18, 2020
@m2-assistant
Copy link

m2-assistant bot commented Apr 18, 2020

Hi @matheusgontijo, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@ghost ghost moved this from Merge in Progress to Recently Merged in Pull Requests Dashboard Apr 18, 2020
@magento-engcom-team magento-engcom-team removed this from Recently Merged in Pull Requests Dashboard Apr 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests Component: Customer Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: accept Release Line: 2.4 Severity: S1 Affects critical data or functionality and forces users to employ a workaround.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants