Skip to content

Conversation

escopecz
Copy link
Member

@escopecz escopecz commented Jan 10, 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? 🔴 (cannot write tests for deleted code)
Related user documentation PR URL mautic/user-documentation#...
Related developer documentation PR URL mautic/developer-documentation-new#...
Issue(s) addressed Fixes #...

Description

It's time to remove the Legacy builder that funny enough I mostly built. It got replaced by the GrapesJS builder many years ago and only few are still preferring the legacy builder nowadays. It got broken during the latest UI upgrades and not many notice (I saw 1 discussion on the topic) and there was no one who would care to fix it. So it's time to say goodbye and make Mautic a little leaner, simpler and faster.

This is what happens when you disable the GrapesJS plugin and try to use the email or page builder:
Screenshot 2025-01-26 at 19 52 03

Todo:

  • Regenerate css
  • Go through removed twig templates and search for translation strings if we still need those
  • Fix CI

📋 Steps to test this PR:

  1. Open this PR on Gitpod or pull down for testing locally (see docs on testing PRs here)
  2. Test that the GrapesJS builder works as before in Landin Pages and Emails
  3. Test that the preference center still works. Both when using a preference center landing page and the default preference center.
  4. Test that nothing really breaks when you disable the GrapesJS plugin but you won't be able to launch the builder and a helpful message will show up instead.

@escopecz escopecz force-pushed the removing-legacy-builder branch from 3c85b0d to 384b2c2 Compare January 10, 2025 20:26
@escopecz escopecz force-pushed the removing-legacy-builder branch from 67694a4 to d22a3a8 Compare January 25, 2025 11:43
@escopecz escopecz added this to the 6.0 milestone Jan 25, 2025
@escopecz escopecz added builder-legacy Anything related to the legacy email or landing page builders refactoring The change does not change behavior but improves the code bc-break A BC break PR for major release milestones only labels Jan 25, 2025
Copy link

codecov bot commented Jan 26, 2025

Codecov Report

Attention: Patch coverage is 70.37037% with 8 lines in your changes missing coverage. Please review.

Project coverage is 64.07%. Comparing base (7cfae6f) to head (8f456dc).
Report is 37 commits behind head on 6.x.

Files with missing lines Patch % Lines
...undles/EmailBundle/Controller/PublicController.php 66.66% 4 Missing ⚠️
...p/bundles/PageBundle/Controller/PageController.php 0.00% 2 Missing ⚠️
...bundles/EmailBundle/Controller/EmailController.php 0.00% 1 Missing ⚠️
app/bundles/EmailBundle/Model/EmailModel.php 50.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##                6.x   #14450    +/-   ##
==========================================
  Coverage     64.07%   64.07%            
+ Complexity    34677    34528   -149     
==========================================
  Files          2287     2265    -22     
  Lines        103786   103175   -611     
==========================================
- Hits          66499    66108   -391     
+ Misses        37287    37067   -220     
Files with missing lines Coverage Δ
...reBundle/DependencyInjection/Compiler/TwigPass.php 100.00% <ø> (+23.07%) ⬆️
app/bundles/CoreBundle/Event/BuilderEvent.php 67.85% <ø> (-7.82%) ⬇️
app/bundles/CoreBundle/Model/BuilderModelTrait.php 81.25% <ø> (+2.08%) ⬆️
app/bundles/CoreBundle/Twig/Helper/ThemeHelper.php 86.95% <ø> (-1.05%) ⬇️
...es/EmailBundle/EventListener/BuilderSubscriber.php 99.13% <ø> (-0.17%) ⬇️
app/bundles/EmailBundle/Form/Type/EmailType.php 97.75% <100.00%> (+0.01%) ⬆️
app/bundles/EmailBundle/Helper/MailHelper.php 78.85% <100.00%> (+0.41%) ⬆️
...p/bundles/EmailBundle/Model/SendEmailToContact.php 95.76% <100.00%> (ø)
...p/bundles/FormBundle/Controller/FormController.php 45.23% <100.00%> (-0.12%) ⬇️
...bundles/FormBundle/Controller/PublicController.php 44.13% <100.00%> (-0.27%) ⬇️
... and 9 more

... and 3 files with indirect coverage changes

@escopecz escopecz added ready-to-test PR's that are ready to test code-review-needed PR's that require a code review before merging labels Jan 26, 2025
@escopecz escopecz mentioned this pull request Jan 26, 2025
@escopecz escopecz marked this pull request as ready for review January 27, 2025 10:21
@RCheesley RCheesley modified the milestones: 6.0.0-alpha, 6.0.0-beta Jan 27, 2025
@matbcvo matbcvo added the pending-feedback PR's and issues that are awaiting feedback from the author label Jan 27, 2025
Some CSS styles that seem to be related to the legacy builder must be returned back
Co-authored-by: Martin Vooremäe <martin.vooremae@gmail.com>
@escopecz escopecz removed the pending-feedback PR's and issues that are awaiting feedback from the author label Jan 27, 2025
@escopecz escopecz requested review from matbcvo and RCheesley January 27, 2025 19:25
Copy link
Contributor

@matbcvo matbcvo left a comment

Choose a reason for hiding this comment

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

The code changes look good to me. I’ve tested the PR and found no issues.

@RCheesley
Copy link
Member

When I tried to test this by opening an old email (the test one from sample data) which used the blank theme, I am greeted with a partly blank screen with no builder or editor.

I think for these old theme emails we should perhaps be opening them in the GrapesJS builder as an HTML email?

Here's a screencast: https://app.screencastify.com/v3/watch/Nmlm5epI7LeAY7zBEDdn

The blank theme should support the GrapesJS builder however it seems like it's loading in the old one:

Themes-Mautic-02-05-2025_11_30_AM

Copy link
Member

@RCheesley RCheesley left a comment

Choose a reason for hiding this comment

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

Sorry forgot to leave as a RQ review!

@escopecz
Copy link
Member Author

escopecz commented Feb 5, 2025

@RCheesley I cannot reproduce:

Screen.Recording.2025-02-05.at.13.42.41.mov

Please make sure you've run npm ci and bin/console mautic:assets:generate and also clear assets in your browser. Perhaps there is something cached.

@RCheesley
Copy link
Member

I've run npm ci and regenerated assets (I'm in dev mode, locally) and still getting it opening in the old browser :( Also tried this in Gitpod to rule out funky stuff with my local environment.

@escopecz can you please try in Gitpod so we have reproducible environments with the sample data?

@escopecz
Copy link
Member Author

escopecz commented Feb 5, 2025

I don't think it's the old browser that's opening. I think it's the GrapesJS builder but having some issue with the content. I'll try to use the sample data as you do when I find a free minute.

@matbcvo
Copy link
Contributor

matbcvo commented Feb 5, 2025

I can reproduce @RCheesley's issue on Gitpod with sample data loaded.

JavaScript error appears in the console when opening the Builder:

Uncaught Error: No valid HTML template found
    at O.getOriginalContentHtml (builder.js?v05d545f1:10:2514)
    at tc.initEmailHtml (builder.js?v05d545f1:85:5826)
    at tc.initGrapesJS (builder.js?v05d545f1:85:3225)
    at Mautic.launchBuilder (builder.js?v05d545f1:85:9673)
    at HTMLButtonElement.onclick (1:1:8)
    at Object.trigger (jquery.js?v05d545f1:8635:27)
    at HTMLButtonElement.<anonymous> (jquery.js?v05d545f1:8707:17)
    at Function.each (jquery.js?v05d545f1:383:19)
    at jQuery.fn.init.each (jquery.js?v05d545f1:205:17)
    at jQuery.fn.init.trigger (jquery.js?v05d545f1:8706:15)
Screen.Recording.2025-02-06.004456.mp4

Also I tested it on the 6.x branch, encountered the same issue. The builder opens, but still broken and the same error appears in the console. I can't close the builder or save, it's stuck.

Screen.Recording.2025-02-06.011009.mp4

@escopecz
Copy link
Member Author

escopecz commented Feb 6, 2025

@RCheesley do you mind merging this and fixing the sample data issue later as it wasn't introduced in this PR?

@RCheesley
Copy link
Member

@escopecz sure let's raise a separate issue so we don't lose track of it.

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.

Finally 👍
Seems good.
Works and code diff seems 👍

@matbcvo matbcvo added user-testing-passed PRs which have been successfully tested by the required number of people. ready-to-commit PR's with 2 successful tests, 1 approval, automated tests and docs and is ready to be merged and removed pending-test-confirmation PR's that require one test before they can be merged labels Feb 6, 2025
@RCheesley
Copy link
Member

Flagged up the issue in #14563 to be fixed separately.

@escopecz escopecz removed the code-review-needed PR's that require a code review before merging label Feb 7, 2025
@escopecz escopecz merged commit f0c0ef4 into mautic:6.x Feb 7, 2025
17 checks passed
@RCheesley RCheesley modified the milestones: 6.0.0-beta, 6.0.0-beta2 Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bc-break A BC break PR for major release milestones only builder-legacy Anything related to the legacy email or landing page builders ready-to-commit PR's with 2 successful tests, 1 approval, automated tests and docs and is ready to be merged refactoring The change does not change behavior but improves the code user-testing-passed PRs which have been successfully tested by the required number of people.
Projects
Status: 🥳 Done
Development

Successfully merging this pull request may close these issues.

4 participants