Fix: save newsletter template#5285
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes saving existing newsletter templates by ensuring template_type is handled as an integer (matching validation expectations), and adds UI/test coverage for a successful save in the admin newsletter template editor.
Changes:
- Add explicit
getTemplateType()/setTemplateType()implementations inMage_Newsletter_Model_Templateto coercetemplate_typetoint. - Add an admin session success message after saving a newsletter template.
- Update Cypress e2e to cover saving an existing newsletter template and assert the success message.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
cypress/e2e/openmage/backend/newsletter/template.cy.js |
Updates edit-route test to save an existing template and check for a success message. |
app/locale/en_US/Mage_Newsletter.csv |
Adds a new translation string for the save success message. |
app/code/core/Mage/Newsletter/Model/Template.php |
Introduces typed getter/setter for template_type to satisfy int validation. |
app/code/core/Mage/Core/Model/Email/Template/Abstract.php |
Docblock updates for template text/type method annotations. |
app/code/core/Mage/Adminhtml/controllers/Newsletter/TemplateController.php |
Adds a save success message and returns immediately after redirect. |
Removed unnecessary iframe existence check and wait.
|
Co-authored-by: B3Hana <180432612+B3Hana@users.noreply.github.com>
…ntroller.php Co-authored-by: B3Hana <180432612+B3Hana@users.noreply.github.com>
…ntroller.php Co-authored-by: B3Hana <180432612+B3Hana@users.noreply.github.com>
|
@all-contributors add @B3Hana code |
|
I've put up a pull request to add @B3Hana! 🎉 |
|
But better safe than sorry? |
Good one ... not sure/untested if validateChoice is type-safe. (1 vs "1"). |
|
Want to add a new test case? |
} elseif ($constraint->match xor \in_array($value, $choices, true)) {this says that strict makes it type-safe:
so no extra test case needed |
|
PR to remove additional check? |



Description (*)
Cant save existing newsletter template b/c "template_type" has to be an integer value, string given.
Related Pull Requests
Zend_Validatewithsymfony/validator#4612Manual testing scenarios (*)