crmMailing - Only load Angular settings if they're needed #18749
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This removes extraneous data from Angular-based screens which do not have a CiviMail UI.
This patch was written as an exercise in reviewing #18731.
Before
civicrm/a/#/mailing/1
and open a browser console, you can see thatCRM.crmMailing
is populated. This is good because we're on the mailing page.civicrm/admin/afform
and open a browser console, you again see thatCRM.crmMailing
is populated. This is extraneous becausecrmMailing
is never activated on this screen.After
civicrm/a/#/mailing/1
and open a browser console, you can see thatCRM.crmMailing
is populated. This is good because we're on the mailing page.civicrm/admin/afform
and open a browser console, you can see thatCRM.crmMailing
is not populated.Comments
In reading the diff, it looks slightly noisier than it should. What's actually happened is that I used a refactoring (Extract Method) to move several lines from
getAngularModules()
to a separate functioncreateAngularSettings()
. Due to the dependence on the other PR and the quirks in diff format, it makes it appear as if some unrelated functions are removed+readded. 🤷♂️