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

Allow setting admin user notification email receiver #3722

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Judx
Copy link
Contributor

@Judx Judx commented Jan 3, 2024

Description (*)

This PR allows setting receiver email to "New Admin User Create Notification". Default is that email is sent to store general email address. In some cases it is necessary to allow changing the notification receiver.

Related Pull Requests

Depends on and includes changes from #3721

Fixed Issues (if relevant)

No.

Manual testing scenarios (*)

  1. Pull changes.
  2. Find and set email address in: System -> Admin -> Security -> Notification Email Receiver
  3. Create new admin user and see that the notification email is received by the specified address.

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All automated tests passed successfully (all builds are green)
  • Add yourself to contributors list

@github-actions github-actions bot added Component: Core Relates to Mage_Core Component: Adminhtml Relates to Mage_Adminhtml Component: Admin Relates to Mage_Admin labels Jan 3, 2024
@Judx Judx mentioned this pull request Jan 3, 2024
4 tasks
$emails = $this->getUserCreateAdditionalEmail();
$emails[] = $generalContactEmail;
// collect general and additional emails unless overridden
if ($receiverEmail && filter_var($receiverEmail, FILTER_VALIDATE_EMAIL)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Zend_Validate::is($receiverEmail, 'EmailAddress') perhaps?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, because FILTER_VALIDATE_EMAIL is not used.

@@ -1256,16 +1256,28 @@
<show_in_website>0</show_in_website>
<show_in_store>0</show_in_store>
</extensions_compatibility_mode>
<crate_admin_user_notification translate="label comment">
<create_admin_user_notification translate="label comment">
Copy link
Contributor

Choose a reason for hiding this comment

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

I would leave the typo as-is. Yes, you move the value to the new setting, but legacy code may still use the old xpath.

Copy link
Contributor

Choose a reason for hiding this comment

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

For legacy code, this can be used, if I remember correctly:

<crate_admin_user_notification deprecated="true">
    <config_path>admin/security/create_admin_user_notification</config_path>
</crate_admin_user_notification>

Copy link
Contributor

Choose a reason for hiding this comment

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

Where is that @luigifab ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Here:

<account translate="label" module="paypal">
<label>Merchant Location</label>
<fieldset_css>paypal-config</fieldset_css>
<expanded>1</expanded>
<sort_order>5</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<frontend_model>paypal/adminhtml_system_config_fieldset_location</frontend_model>
<fields>
<merchant_country translate="label comment">
<label>Merchant Country</label>
<config_path>paypal/general/merchant_country</config_path>

<label>New Admin User Create Notification</label>
<comment>This setting enable notification when new admin user created.</comment>
<comment>This setting enables notification when new admin user is created.</comment>
Copy link
Contributor

Choose a reason for hiding this comment

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

This is ok to change.

Copy link
Contributor

Choose a reason for hiding this comment

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

Before changing the comment, please check if there is a translation for that phrase. If exists you should change only the CSV file.

Copy link
Contributor

Choose a reason for hiding this comment

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

yep, needs to be changed in Mage_Core.csv instead of here, so that we don't break language packs

@@ -1256,16 +1256,28 @@
<show_in_website>0</show_in_website>
<show_in_store>0</show_in_store>
</extensions_compatibility_mode>
<crate_admin_user_notification translate="label comment">
<create_admin_user_notification translate="label comment">
Copy link
Contributor

Choose a reason for hiding this comment

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

In #3721 was decided not to create a breaking change to fix a typo, let's please address the comments made by other users if possible

@fballiano fballiano marked this pull request as draft April 19, 2024 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Admin Relates to Mage_Admin Component: Adminhtml Relates to Mage_Adminhtml Component: Core Relates to Mage_Core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants