Conversation
The processor read block fields under the wrong keys (e.g. `email_template` instead of `mail_template`), so the selected mail template, admin info, header/footer and sender/recipient addresses were silently dropped and the defaults used instead. - Type the block payload (`SchemaFormBlock`) and the submission context so a wrong key is visible rather than silently defaulted. - Extract the email helpers (`substitute_variables`, `format_property`, `addresses_from_block`, template lookup, mailhost check) into `utils.email`; the processor now delegates to them. - Resolve sender/recipient/bcc addresses once, up front, and pass them through the submission context. - Move the mail templates registry setting to a JSONField (`schemaform.mail_templates_json`), deprecating `schemaform.mail_templates`, with an upgrade step (profile 1000 -> 1001) migrating existing templates. - Add unit tests for the `utils.email` helpers. Refs #19
Replace the imperative registry setup in the test layer with a declarative `plone.formblock.testing:testing` profile that configures the mail settings and installs the captcha add-ons (norobots, hcaptcha, recaptcha). Update the captcha vocabulary test for the now-available norobots adapter.
This file contains hidden or 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
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.
What
Fixes the
EmailFormProcessorsilently ignoring the form block's configuredsettings, and moves the mail-template storage to a
JSONFieldso templateselection works end to end.
The processor read several block fields under the wrong keys — most visibly
email_templateinstead ofmail_template— so the selected mail template,admin info, mail header/footer and sender/recipient addresses were dropped and
the defaults used instead.
Changes
Fix + refactor (
0d24af5)SchemaFormBlock) and the submission context, so awrong key is visible rather than silently defaulted.
substitute_variables,format_property,addresses_from_block, template lookup, mailhost check) intoutils.email;the processor delegates to them.
the submission context.
JSONField(
schemaform.mail_templates_json), deprecatingschemaform.mail_templates,with an upgrade step (profile
1000→1001) migrating existing templates.utils.emailhelpers.Testing profile (
74fd676)plone.formblock.testing:testingGenericSetup profile that configures themail settings and installs the captcha add-ons (norobots, hcaptcha,
recaptcha). Captcha vocabulary test updated for the now-available norobots
adapter.
Testing
make test— full backend suite green (146 passed).ruff check/ruff formatclean.Related issue
Refs #19