Batch email change category
| Q | A |
|---|---|
| Bug fix? (use the a.b branch) | 🔴 |
| New feature/enhancement? (use the a.x branch) | 🟢 |
| Deprecations? | 🔴 |
| BC breaks? (use the c.x branch) | 🔴 |
| Automated tests included? | 🟢 |
| Related user documentation PR URL | mautic/user-documentation#... |
| Related developer documentation PR URL | mautic/developer-documentation-new#... |
| Issue(s) addressed | Fixes #... |
Description
This PR addresses the feature discussed here:
To allow changing the email category for multiple messages at a time.
The UI looks like this:
📋 Steps to test this PR:
- Open this PR on Gitpod or pull down for testing locally (see docs on testing PRs here)
- Login
- Go to /s/emails
- If you don't have any email written create a few and put them in different categories
- From the email list, select some
- Click on the batch actions menu
- Select Change Category
- Select a category
- Save
- Refresh the page
- Every previously selected email should belong to the selected category
@mchojrin Hey, is this ready for testing?
@andersonjeccel I think so... I run the tests and they're all passing. Is there any other requirement prior to testing?
Got it!
The main step to have other devs reviewing is to properly fill the description
yeah, it’s boring but contains the minimum basic they need to know about the code (I’ve been creating ~175 PRs for Mautic in the last 6 months, believe me that it’s needed)
would you be up for that? (then I can assign some people to review and the right labels)
@andersonjeccel sure, no problem. I'll get to it ;)
There, @andersonjeccel is this good?
@mchojrin Perfect, thanks!
I tested the PR here and got an error, have a look:
https://github.com/user-attachments/assets/4860be2b-a47f-4cef-b527-7f30735b6238
Steps I tried:
- Go to Emails, create new and select the theme Brienz
- Fill subject and name using
Email 16/07/2024, 08:40:24then Save & Close - Go to Categories, create new and go back to Emails
- Select using the Select all checkbox, open the dropdown and click Change category
- Select the new category and click Save
- The message will appear
Do you have any idea why?
@andersonjeccel I just tried the exact steps you mentioned and it worked alright... Maybe you need to refresh the cache?
@mchojrin Hm, tried both prod and dev environments...
After clearing the cache by manually deleting the cache folder and running ddev exec bin/console cache:clear, it starts showing this way:
It's a clean DDEV install (including database)
Then tried on Gitpod:
What if you try to clear your cache? Perhaps the issue might appear
@andersonjeccel wow.. ok.. I'll try to test in different environments and get back here.
Thanks!
I hope we can solve, there was a lot of your work on it :) call me if you need something
Hey @andersonjeccel just tried again clearing the local cache and on a fresh new gitpod and couldn't reproduce.
Here's my video
I did not an unexpected behaviour that I'll address though, the select category modal is showing all available categories instead of only email ones.
I'll leave the gitpod up if you want to try it https://8080-mchojrin-mautic-b5nqmcv3vbe.ws-eu115.gitpod.io/s/emails
I just checked my code and it is applying the filter by email bundle to the categories shown... perhaps it's a problem with \Mautic\CategoryBundle\Entity\CategoryRepository::getCategoryList?
@escopecz @kuzmany Would you like to have a look?
@escopecz @shinde-rahul nice to see you checking here! thanks for your time
is the PR test working for you? even after those changes, I still get the same 500 Internal Server Error - PHP Warning - Undefined property: Mautic\EmailBundle\Model\EmailModel::$getRepository
- Tried to run composer install again
- Cleared cache manually
- Removed var/cache completely
All with no success :/ I'm using PHP Version 8.3.10
Ok, I think I fixed every point if anyone else wants to take a look
It's working now, showing only email-specific categories for selection and the change is visible immediately after applying!
@mchojrin Tell me when the PR is finished (probably needs only the PHPUnit test to finish as John said)
Codecov Report
Attention: Patch coverage is 30.35714% with 39 lines in your changes missing coverage. Please review.
Project coverage is 62.88%. Comparing base (
a994b57) to head (e0e9f9e). Report is 2 commits behind head on 5.x.
Additional details and impacted files
@@ Coverage Diff @@
## 5.x #14067 +/- ##
============================================
- Coverage 62.90% 62.88% -0.02%
- Complexity 34417 34435 +18
============================================
Files 2264 2267 +3
Lines 102966 103020 +54
============================================
+ Hits 64770 64789 +19
- Misses 38196 38231 +35
| Files with missing lines | Coverage Δ | |
|---|---|---|
| app/bundles/EmailBundle/Model/EmailActionModel.php | 100.00% <100.00%> (ø) |
|
| app/bundles/EmailBundle/Model/EmailModel.php | 53.29% <100.00%> (ø) |
|
| ...bundles/EmailBundle/Controller/EmailController.php | 59.08% <0.00%> (ø) |
|
| ...undles/EmailBundle/Form/Type/BatchCategoryType.php | 0.00% <0.00%> (ø) |
|
| ...es/EmailBundle/Controller/BatchEmailController.php | 0.00% <0.00%> (ø) |
Hey @escopecz I had some issues with ddev, I think I got it all sorted out now so hopefully I'll be able to fix the test soon
I fixed the E2E test, it broke because of changes to the UI... I tried to use element ids as much as possible to avoid this problem but I'm afraid I'll still happen for those elements that don't have one (Such as the batch action menu for emails).
Github is reporting a conflict in the app/bundles/LeadBundle/Translations/en_US/messages.ini that I'm not sure how to solve...
I resolved the conflict by keeping the translation for both branches.
BTW, if there is an ID or a class missing on an HTML element, feel free to add it. It helps not only to have more stable tests but also the UI team as they can target that HTML element.
BTW, if there is an ID or a class missing on an HTML element, feel free to add it. It helps not only to have more stable tests but also the UI team as they can target that HTML element.
Makes sense :)
I guess I'll keep that in mind moving forward so this PR can finally be integrated.
Thanks!
@all-contributors please add @mchojrin for code.
Thanks so much for the contribution @mchojrin and welcome to the community!
In the future it'd be nice to add this kind of behaviour to our user docs but at present we don't have anything about working with list view even, so we're good to merge without it for now.
@mchojrin could you please validate a bug that these changes might have introduced? https://github.com/mautic/mautic/issues/14323