Skip to content

Allow sending email to BCC address when not notifying user. #22810

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

Conversation

Hailong
Copy link
Member

@Hailong Hailong commented May 9, 2019

Description (*)

Order Comments Email Copy would NOT be sent to the specified email address if the send method is set to Bcc, and Notify Customer by Email is not checked when adding a comments from backbend.

The expected behaviour is that whether the Notify Customer by Email is checked, an email copy is sent to the specified email. While now if the Send Order Comments Email Copy Method config is set to Separate Email it goes well. But if the config is set to Bcc, the email can not be sent.

The problem is that the SenderBuilder is used by both order notification and comments notification, so the fix is to add a flag to fix the problem for comments notification.

Fixed Issues (if relevant)

Manual testing scenarios (*)

  1. Navigate to Configuration->SALES->Sales Emails->Order Comments
  2. Input email address in Send Order Comment Email Copy To
  3. Select Bcc for Send Order Comments Email Copy Method.
  4. Go to any order, add a new comment to the order and leave the Notify Customer by Email unchecked.
  5. Verify the email address set in Step 2 can receive email after submitting the comment.

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@m2-assistant
Copy link

m2-assistant bot commented May 9, 2019

Hi @Hailong. 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-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me 2.3-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

* @return void
*/
public function sendCopyTo()
public function sendCopyTo($toBcc = false)
Copy link
Contributor

Choose a reason for hiding this comment

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

Unfortunately, we are not allowed to change public methods signature according to the Backward Compatible Development Guide.

Copy link
Member Author

Choose a reason for hiding this comment

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

@dmytro-ch thanks for your review. But I assume if the class is not annotated by @api, we can update the signature. This class is kind of an utility class used by other two classes in the same folder, which are annotated by @api.

Copy link
Member Author

Choose a reason for hiding this comment

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

@dmytro-ch I do think it's not the best idea to add this flag here too, but this the minimal change to fix this issue. But let me try with a better approach anyway.

Copy link
Member Author

Choose a reason for hiding this comment

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

I just moved the check of CopyMethod to the caller class, so that to avoid introducing the signature. It looks more clear this way.

Copy link
Member Author

@Hailong Hailong left a comment

Choose a reason for hiding this comment

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

Updated the code to avoid modifying the method signature.

@dmytro-ch
Copy link
Contributor

Hi @Hailong,
could you please check and fix the automated tests failures?
Once the changes are applied, please squash all commits into a single one in order to cleanup history.
Thank you!

@Hailong Hailong force-pushed the send-comments-notify-to-bcc-address branch 3 times, most recently from a43c11a to 3c6c58e Compare May 15, 2019 01:09
@Hailong Hailong force-pushed the send-comments-notify-to-bcc-address branch from 3c6c58e to 08327f7 Compare May 15, 2019 02:34
@Hailong Hailong requested a review from dmytro-ch May 15, 2019 04:07
@Hailong
Copy link
Member Author

Hailong commented May 15, 2019

@dmytro-ch I just fixed the failures in UT. I also introduced two const in the Magento\Sales\Model\Order\Email\Sender class, but I'm not quite sure it's allowed in this class. If not, I will need to find some other place or replace them with plain strings.

@dmytro-ch
Copy link
Contributor

Hi @Hailong, sorry for late reply and thanks for your patience!

Unfortunately, it's not allowed to define new public constants. Please check the Semantic Version Checker build for reference.

Could you please also update your working branch with the latest changes from mainline?

Thank you!

@Hailong
Copy link
Member Author

Hailong commented Jun 24, 2019

Thank you @dmytro-ch , I have just removed the newly added constants. Let's see how the checking goes this time.

@Hailong
Copy link
Member Author

Hailong commented Jun 25, 2019

@dmytro-ch The build checks look good this time, can you please check?

@engcom-Alfa
Copy link
Contributor

Hi @Hailong ,
Could you, please, solve the problem with conflicting files?
Thanks!

@Hailong
Copy link
Member Author

Hailong commented Aug 22, 2019

Hi @engcom-Alfa , the conflict has been resolved. Thanks.

@engcom-Alfa engcom-Alfa requested a review from sidolov August 23, 2019 12:18
@magento-engcom-team
Copy link
Contributor

Hi @sidolov, thank you for the review.
ENGCOM-5650 has been created to process this Pull Request
✳️ @sidolov, could you please add one of the following labels to the Pull Request?

Label Description
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests
Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests
Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests

@engcom-Alfa
Copy link
Contributor

✔️ QA Passed

@m2-assistant
Copy link

m2-assistant bot commented Aug 30, 2019

Hi @Hailong, 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.

@magento-engcom-team magento-engcom-team added this to the Release: 2.3.4 milestone Aug 30, 2019
@sidolov sidolov added the Auto-Tests: Covered All changes in Pull Request is covered by auto-tests label Sep 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants