-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Fix missing @defaults theme folder in composer installation #14425
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if there's a way to avoid having to maintain 2 duplicate locations for the same stuff
This PR means that updating these defaults will also require that all changes made to /themes/@defaults/... will also have to be copied to /app/assets/scaffold/...
Do you have any idea?
@andersonjeccel That’s currently how the scaffold files work. So changing that is a separate change best in another PR. My suggestion though would be perhaps to “build” the assets/scaffold folder during package release - I am not familiar with that process though and only say this as I found what I thought was some file list builders in the packages folder - so it felt there’s already some automation there that could be expanded. |
@driskell The most efficient solution I can think at this moment would be to move the defaults folder into one of the bundles, changing the path from each theme to point to the new location We probably could move forward without a duplicate instance of it, what do you think? |
@andersonjeccel I thought about that but the app folder has a https://github.com/mautic/mautic/blob/6.x/app/.htaccess I think as well this only solves it for the theme defaults - not for any other duplicated files in the scaffold area. So I don't think not doing work here is going to cause more work later. Ideally the solution for @defaults would work for the others too so that's why I thought it better to just keep the status quo and then work on that separately at some point if indeed it becomes an issue. The likelihood of these files changing seems fairly slim though I think much like the other scaffold files. And indeed the current approach has some advantages in that an installation could override and replace these files as they see fit to change the defaults - where bundling them in with |
@driskell Got it, makes sense. Let's proceed this way then Do you have any clue why the PHPUnit test is failing? |
Sorry I don't - it seems relating to asset download so I thought maybe a randomly failure but unfortunately I don't have access to re-run the tests. But I can try force push a change and see if it works. |
f93fb10
to
6d968b4
Compare
@andersonjeccel Yeh it was a random test failure. All pass now! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem right. But I also don't fully understand this Composer magic. Shouldn't this theme be mentioned on the same places as other themes? For example this is where the Skyline theme is mentioned but the @defaults theme is not:
Line 82 in 0d57852
"mautic/theme-skyline": "self.version", 'skyline', "name": "theme-skyline", - theme-skyline - https://github.com/search?q=repo%3Amautic%2Fmautic%20skyline&type=code
mautic/.github/subtree-splitter-config.json
Line 149 in 0d57852
"name": "theme-skyline",
It felt like these were not a theme but shared assets so I went the asset right but you could be right it be better to be its own bundle and added to the dependencies of each core theme so updates bring it in. Happy to close in that case but I think it might be beyond my contribution to create that theme as I not familiar with the working of that split stuff and not sure how I would test it. I could try tho as you outlined the files but it would probably be an untested PR 😬 |
@mollux do you think you could advise here? |
I find that it would be better to create @escopecz has already listed the files that need to be updated or created to set up the |
@trianity This |
Thanks, I can confirm: copying the |
also Landing page builder (with blank theme) is working again after copying |
Or can we move the default theme twig files here? https://github.com/mautic/mautic/tree/6.x/app/bundles/CoreBundle/Resources/views/Theme |
Yes, it's possible to move these files to -{% extends "@themes/@defaults/html/base.html.twig" %}
+{% extends "@MauticCore/Theme/base.html.twig" %} I just tested it, and this would be an even better option. |
@andersonjeccel @escopecz @matbcvo On our platforms we block all |
In Mautic |
@driskell I was talking more about the twig files. You are right, the images should be moved to the media directory. |
Yeh sorry, quick to jump to reply! I will see if I can work on splitting the base templates to CoreBundle then and look at treating these images like the current images are treated. |
… accessible in composer installation
6d968b4
to
91342dc
Compare
OK @escopecz @andersonjeccel I've done an initial draft - just gonna convert this to a GitHub Draft though so it's clear as I need to get some testing time which will need to be next week. Let me know if it looks like what you intended though and I'll get the testing done to make sure it all works OK. 👍 Thanks everyone for the feedback so far! In the meantime if anyone reaches here the workaround is to make sure you have |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## 5.2 #14425 +/- ##
=========================================
Coverage 63.44% 63.45%
- Complexity 34630 34636 +6
=========================================
Files 2273 2273
Lines 103594 103603 +9
=========================================
+ Hits 65728 65741 +13
+ Misses 37866 37862 -4 |
I just tested your PR (emails, forms, landing pages, unsubscribe page). No issues found so far, it works as expected. Placeholder images are present and publicly accessible. |
@driskell Why getOverridableUrl to retrieve the placeholders? |
I copied how it was done for the other images in the assets folder - which allow a copy to be made into the media folder to override them. I just went and used the same loading method as the other assets in that folder so I didn’t need to find the right API myself, but I didn’t think too much about it 😬 I can adjust if someone drops a review with what to use instead though. Might be ok though as it still should work and just has added bonus of behaving like the others and allowing overrides |
@driskell From what I got, the solution will lead to only one place for managing these placeholders and using this function automatically solves technical things related to security, to get the theme working as expected for end users Is it right? (I'm really not a PHP dev) |
Correct - maintenance of the Mautic product wise - only one location for both the base templates and shared assets. And users can override the templates as per normal I expect and also user can override the assets in their media folders. The function is used elsewhere so yes I would expect it to be safe and vetted already 😊 If not - one fix will fix it for all usages including existing usages. |
@driskell Got it! Thank you for explaining:) |
Issue on my side, sorry, ignore this |
I'm not sure what you meant by |
Sorry. I realise now there is no issue. So I will strike through this. Sorry for the confusion. I'm using Nginx and it looks like we missed allowing access to |
Description
Add missing scaffold for the
themes/@default
I don't know how to easily test this so need some help to test it
📋 Steps to test this PR:
Not sure as it relates to scaffold files