-
Notifications
You must be signed in to change notification settings - Fork 26
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
Dynamic email registration recipients using variables #4971
Merged
sergei-maertens
merged 12 commits into
master
from
feature/4650-set-submission-email-address-using-url-parameters
Dec 31, 2024
Merged
Dynamic email registration recipients using variables #4971
sergei-maertens
merged 12 commits into
master
from
feature/4650-set-submission-email-address-using-url-parameters
Dec 31, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
robinmolen
force-pushed
the
feature/4650-set-submission-email-address-using-url-parameters
branch
from
December 24, 2024 16:16
82c9584
to
472a4fd
Compare
There are two tasks that still have to be done:
|
robinmolen
force-pushed
the
feature/4650-set-submission-email-address-using-url-parameters
branch
from
December 24, 2024 16:26
472a4fd
to
575b635
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4971 +/- ##
==========================================
+ Coverage 96.64% 96.66% +0.01%
==========================================
Files 761 761
Lines 25908 25939 +31
Branches 3386 3392 +6
==========================================
+ Hits 25040 25074 +34
+ Misses 604 601 -3
Partials 264 264 ☔ View full report in Codecov by Sentry. |
Either the `to_emails` or the `to_email_from_variable` fields should used when registering the email backend plugin. When a variable is selected, the resulting email address will be used for mailings. When the variable doesn't contain an email address, the `to_emails` will be used as fallback.
The variable chosen in the email registration (`to_email_from_variable`) will now actually be used for the mailing. `to_emails` is used as fallback, in case that the variable doesn't return a valid email address. The variable will also be used for the payment status update mailing. If `payment_emails` is defined, these will be used as recipients. Otherwise it will use `to_email_from_variable`, and as a last resort the `to_emails`
The possible combinations of to_emails being empty and to_emails_from_variable possibly being malformed, in combination with having to treat lists of possible email addresses leads to complicated code and a risk of no email being sent at all. Instead, it was decided that: * we keep requiring the field to_emails, to always have a well-formed email address that gives sufficient confidence emails will get delivered _somewhere_ * if a variable is provided, and it has a value, we use that to override the destination email address. This may possibly be a malformed email, or even be completely the wrong type of variable, but that will fail loudly and show up in error monitoring I've added some logging as well for when things eventually go wrong, we have some traces or debugging entrypoints to investigate.
sergei-maertens
force-pushed
the
feature/4650-set-submission-email-address-using-url-parameters
branch
from
December 30, 2024 14:30
6d96cbc
to
e448544
Compare
This should encourage people to pass the proper options and take into account optional/required configuration parameters.
Simplified tests by removing indirection and only set up the test data that is actually required by the test. This also uses some more ergonomic factory utilities rather than hand-wiring everything. Now new tests should have better examples to follow.
The test module is aimed at the generic registration mechanism and just 'happens' to use the email plugin. We do not need to repeat all the various cases/failure modes that are already covered by the plugin unit tests.
sergei-maertens
force-pushed
the
feature/4650-set-submission-email-address-using-url-parameters
branch
2 times, most recently
from
December 31, 2024 07:51
98c981f
to
b1f2801
Compare
* Added fieldsets to group related options together * Use a shorter form field label and describe the behaviour in the help text * Filter down the available variables to compatible data types (only strings and arrays can produce valid values) * Updated stories to provide some available variables in the context * Mark toEmails configuration field as required, since it always is * Clean up the formik hook/props usage * Ensure that the 'empty' value is normalized when calling the onChange behaviour to normalize formik data types to what the backend expects
sergei-maertens
force-pushed
the
feature/4650-set-submission-email-address-using-url-parameters
branch
from
December 31, 2024 07:58
b1f2801
to
fa86b04
Compare
With product prefill, the premise is that the product data is personal and likely contains sensitive/private data that gives only the person with a particular BSN access. This requires the person to authenticate and then their BSN is compared with some property in the retrieved object. However, there may be 'public' data used to prefill some variables, either user defined or even form variables. Multiple people can use those objects, even without authenticating in the first place. You can now flag a prefill to not require this kind of ownership check.
* Added tests for configuration validation * Added tests for runtime behaviour
sergei-maertens
force-pushed
the
feature/4650-set-submission-email-address-using-url-parameters
branch
from
December 31, 2024 08:23
fa86b04
to
b8d142b
Compare
sergei-maertens
approved these changes
Dec 31, 2024
sergei-maertens
deleted the
feature/4650-set-submission-email-address-using-url-parameters
branch
December 31, 2024 08:24
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #4650
Changes
The email registration plugin now allows setting the recipient using form variables. This can be combined with the prefill to dynamically set the recipients of a form.
With this, either the emails field (internally known as
to_emails
) or the email variable field has to be filled. When both are used, the mailing will favor the variable. If for some reason the variable cannot be used for the mailing (i.e. when the variable doesn't result into a valid email address), then the general emails configuration (to_emails
) will be used.The variable can also be used for the payment status update mailings. For the payment status mailing the payment status email addresses will be used. If these aren't defined, then the variable is used and as last resort the general emails configuration will be used.
Checklist
Check off the items that are completed or not relevant.
Impact on features
Release management
I have updated the translations assets (you do NOT need to provide translations)
./bin/makemessages_js.sh
./bin/compilemessages_js.sh
Dockerfile/scripts
./bin
folderCommit hygiene