Skip to content

Conversation

driskell
Copy link
Contributor

@driskell driskell commented Jan 4, 2025

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? 🟢

Docs PR: mautic/user-documentation#349

Description

When creating a new segment with filters, it displays immediately "No Contacts". This can be confusing to new users as it does not indicate there is an action waiting to build the new segment. Additionally, once build begins, you will see "123 Contacts" - however, the build may not be finished yet. The only way a user can know it is finished is to keep refreshing the page until the count does not change for a minute. It's not really easy to know if it's completed.

Similarly, when editing a segment, for example if you realised you captured too many due to a typo, after saving you just see the same contact count. There is no indication that a rebuild is waiting that might substantially change the count (even potentially reducing it to "No Contacts"). Neither is there indication of progress or when it completes. So again you are left refreshing the page waiting for it to stop changing. In cases where the change is 0 it is then even more difficult as you cannot know if it just didn't get around to rebuilding yet or if it did rebuild but it was 0 change because of an error in your filters.

This PR adds in additional statuses, bringing the list to:

  • Building - Displayed for a new segment that has filters which is not yet built
  • No Contacts - Displayed for a segment with filters that has been successfully built at least once since creation or last modification
  • Building (X Contacts) - Displayed for a segment with filters that has been modified since it was last built
  • X Contacts - Displayed for a segment with filters that has been successfully built at least once since creation or last modification

Screenshot for a new segment:

Screenshot 2025-01-04 at 12 32 24

After mautic:segments:update passes over it:

Screenshot 2025-01-04 at 12 45 52

After it is modified by a user:

Screenshot 2025-01-04 at 12 46 21

This then returns to the previous screen after mautic:segments:update passes over it.

📋 Steps to test this PR:

  1. Open this PR on Gitpod or pull down for testing locally (see docs on testing PRs here)
  2. Create a new segment without filters. It will display No Contacts.
  3. Create a new segment with filters. It will display Building.
  4. Run mautic:segments:update. It will now display No Contacts or X Contacts depending on the filters.
  5. Edit the segment's filters. It will display either Building or Building (X Contacts) depending on the previous filters.
  6. Run mautic:segments:update. It will now display No Contacts or X Contacts depending on the filters.

I did deprecate the Mautic\LeadBundle\Entity\LeadList::initializeLastBuiltDate as we need to allow null last built date for new segments. Previously it would be set to a last built date of now for a new segment which was incorrect. The field was always nullable though so it's hard to say how bad a BC change this would be. I left the method in place as it was public, and marked it @deprecated.

My sponsoring organisation here is Other Media

@driskell
Copy link
Contributor Author

driskell commented Jan 4, 2025

I have some other work pending that hopefully I can follow up with later. Specifically there is one where I made mautic:segments:update accept a parameter to say only update new or modified segments. Running this as a new cron allows the Building labels to be rapidly removed and provides a massive benefit to users as they don't need to wait ages for the update to eventually reach their segment - in parallel we specifically run updates for new or modified.

@driskell
Copy link
Contributor Author

driskell commented Jan 4, 2025

Will check tests in some time. Looks like I was gonna add test for the class changes in the AJX and forgot! Will look at it when I can but welcome feedback in the interim

Copy link

codecov bot commented Jan 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 63.73%. Comparing base (e837fc7) to head (78827dd).
Report is 316 commits behind head on 6.x.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##                6.x   #14431      +/-   ##
============================================
- Coverage     63.74%   63.73%   -0.01%     
- Complexity    34646    34651       +5     
============================================
  Files          2279     2279              
  Lines        103739   103746       +7     
============================================
+ Hits          66126    66127       +1     
- Misses        37613    37619       +6     
Files with missing lines Coverage Δ
...p/bundles/LeadBundle/Controller/AjaxController.php 19.87% <100.00%> (+0.69%) ⬆️
app/bundles/LeadBundle/Entity/LeadList.php 97.27% <100.00%> (+0.05%) ⬆️

... and 1 file with indirect coverage changes

@driskell driskell force-pushed the segment-rebuild-status branch 2 times, most recently from 61cf652 to 44c6718 Compare January 6, 2025 09:27
@driskell
Copy link
Contributor Author

driskell commented Jan 6, 2025

Fixed the tests and added missing CSS classes test.
Not sure what the CS Fixer failure is as it seems completely unrelated to the code so possible an existing test failure.

@andersonjeccel
Copy link
Contributor

Hey @driskell, could you rebase your branch and change the target to 6.x?

5.2 is receiving only bug fixes at this time

@andersonjeccel andersonjeccel added T1 Low difficulty to fix (issue) or test (PR) user-experience Anything related to related to workflows, feedback, and navigation enhancement Any improvement to an existing feature or functionality needs-rebase PR's that need to be rebased segments Anything related to segments labels Jan 6, 2025
@andersonjeccel andersonjeccel self-requested a review January 6, 2025 12:35
@driskell driskell force-pushed the segment-rebuild-status branch from 44c6718 to 1d9a78d Compare January 6, 2025 13:57
@driskell driskell changed the base branch from 5.x to 6.x January 6, 2025 13:57
@driskell
Copy link
Contributor Author

driskell commented Jan 6, 2025

Hey @driskell, could you rebase your branch and change the target to 6.x?

5.2 is receiving only bug fixes at this time

Ah is there no 5.3 due then? (I targeted 5.x not 5.2)

I rebased to 6.x anyway but it looks like it cleanly applies to both with exception of 1 line in the AjaxController so easy to cherry if there was going to be a 5.3 and it was deemed useful.

@andersonjeccel
Copy link
Contributor

@driskell We're moving all new enhancements and features to 6.x without 5.3. As the release calendar is many months late, Mautic will skip some versions until we get up to date :)

@andersonjeccel
Copy link
Contributor

@driskell Re. the failing tests, could you check PHUnit?

@driskell
Copy link
Contributor Author

driskell commented Jan 6, 2025

I think bogus - looks like a random fail due to time or something and the baseline never was changed. I’ll push again to force rerun as perhaps it ran it on the push before I changed the base and didn’t rerun

@driskell
Copy link
Contributor Author

driskell commented Jan 6, 2025

@andersonjeccel Looks good now!

btw do you know is there a way for me to get onto the development slack? I think the register is locked for external users at the moment.

@driskell
Copy link
Contributor Author

driskell commented Jan 7, 2025

I think the needs-rebase tag can be removed now

Copy link
Contributor

@andersonjeccel andersonjeccel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before running command with contacts added manually to dynamic segment
image

Recently set filter:

image

After running update command:
image

It seems to be working and it's good for UX

@andersonjeccel andersonjeccel added code-review-needed PR's that require a code review before merging pending-test-confirmation PR's that require one test before they can be merged ux-review-passed php Pull requests that update Php code and removed needs-rebase PR's that need to be rebased labels Jan 7, 2025
@andersonjeccel
Copy link
Contributor

@driskell btw, could you ping me in the Mautic Slack? I'm there as aj

@driskell
Copy link
Contributor Author

@driskell is this PR something that will need retesting?

Yes it will - the code changes per code review so needs a retest

@driskell driskell force-pushed the segment-rebuild-status branch from 4e7b8fa to 78827dd Compare January 20, 2025 12:21
@andersonjeccel andersonjeccel removed the pending-feedback PR's and issues that are awaiting feedback from the author label Jan 21, 2025
@RCheesley RCheesley added the needs-documentation PR's that need documentation before they can be merged label Jan 23, 2025
@RCheesley
Copy link
Member

Please ensure that this is documented in the user docs! Thanks!

@RCheesley RCheesley modified the milestones: 6.0.0-alpha, 6.0.0-beta Jan 27, 2025
@driskell
Copy link
Contributor Author

@escopecz I finished the code review requested changes and also now finished testing it here and it works as before still. 👍

@Hugo-Prossaird
Copy link
Contributor

I tested it on my side, and it seems to be working as expected 👍

Copy link
Member

@kuzmany kuzmany left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've tested it internally and seems working properly 👍

Copy link
Member

@kuzmany kuzmany left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've tested it internally and seems working properly 👍

@escopecz escopecz added ready-to-test PR's that are ready to test code-review-passed PRs which have passed code review user-testing-passed PRs which have been successfully tested by the required number of people. and removed code-review-needed PR's that require a code review before merging pending-test-confirmation PR's that require one test before they can be merged labels Feb 7, 2025
@escopecz
Copy link
Member

escopecz commented Feb 7, 2025

@driskell can you please write a paragraph to the docs about this feature so this could be merged?

@driskell
Copy link
Contributor Author

driskell commented Feb 7, 2025

@driskell can you please write a paragraph to the docs about this feature so this could be merged?

I raised a quick PR here: mautic/user-documentation#349
Let me know if it needs a bit more. Couldn't find a 6.x branch though so perhaps needs rebase

@escopecz escopecz removed the needs-documentation PR's that need documentation before they can be merged label Feb 10, 2025
@escopecz
Copy link
Member

Thanks!

@escopecz escopecz merged commit 6bcdb20 into mautic:6.x Feb 10, 2025
17 checks passed
@RCheesley RCheesley modified the milestones: 6.0.0-beta, 6.0.0-beta2 Mar 5, 2025
@mautibot
Copy link
Contributor

mautibot commented Mar 6, 2025

This pull request has been mentioned on Mautic Forums. There might be relevant details there:

https://forum.mautic.org/t/announcing-mautic-6-beta-now-available-for-testing/35196/1

@npracht
Copy link
Member

npracht commented Mar 10, 2025

hello @driskell following your great contribution, we have fixed a case: #14706

Can you please review (super easy) ?
Thanks !

@driskell
Copy link
Contributor Author

hello @driskell following your great contribution, we have fixed a case: #14706

Can you please review (super easy) ? Thanks !

I'll jump across! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code-review-passed PRs which have passed code review enhancement Any improvement to an existing feature or functionality php Pull requests that update Php code ready-to-test PR's that are ready to test segments Anything related to segments T1 Low difficulty to fix (issue) or test (PR) user-experience Anything related to related to workflows, feedback, and navigation user-testing-passed PRs which have been successfully tested by the required number of people. ux-review-passed
Projects
Status: 🥳 Done
Development

Successfully merging this pull request may close these issues.

8 participants