-
Notifications
You must be signed in to change notification settings - Fork 835
Add form notifications settings panel #45396
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
base: trunk
Are you sure you want to change the base?
Conversation
I've added the feature flag ``jetpack_forms_enable_notifications` to enable/disable the whole form notification settings panel in the editor`
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! Jetpack plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
...cts/packages/forms/src/blocks/contact-form/components/jetpack-form-notifications-settings.js
Outdated
Show resolved
Hide resolved
...cts/packages/forms/src/blocks/contact-form/components/jetpack-form-notifications-settings.js
Outdated
Show resolved
Hide resolved
...cts/packages/forms/src/blocks/contact-form/components/jetpack-form-notifications-settings.js
Outdated
Show resolved
Hide resolved
Code Coverage SummaryCoverage changed in 3 files.
1 file is newly checked for coverage.
|
'ip' => $this->ip_address, | ||
'subject' => $this->subject, | ||
'ip' => $this->ip_address, | ||
'notification_recipients' => $this->notification_recipients, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks correct to me :)
Make it less verbose since we're already in the JetpackForms context. Renamed to NotificationsSettings.
We don't need to store notification_recipients in a field like we're doing with subject—which is done that way for legacy reasons. It should come via the JWT token which is searlized and unsearlized on form submission then available via the form attributes
Added server side validation of the notification recipients to make sure they should receive the notifications—protection against frontend tampering. It also covers the case where the user role might have changed. I've added unit tests covering these cases
* @param array $recipients The notification recipients. | ||
* @return void | ||
*/ | ||
public function set_notification_recipients( $recipients ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I can tell we don't use this anywhere.
Introduces a new notifications system that allows site administrators to specify which users should receive notifications when form responses are submitted.
Proposed changes:
NotificationsSettings
component to manage notification recipientsform-notifications
feature flag (default: disabled)notificationRecipients
attribute to Contact_Form defaultsjetpack_forms_enable_notifications
to control the featureOther information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions:
Prerequisites:
To enable this feature you have to add this filter:
add_filter( 'jetpack_forms_enable_notifications', '__return_true' );
Form notifications
.Form notifications
section is no longer present in the sidebar panel