Some decoupling from underscore => _.each pt2 => content overlays #8490
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.
Prerequisites
Description
This is an addition to #8475, splitting into multiple PRs to avoid giant merges. These changes remove underscore from the content overlay controllers (the ones used for the publish/save/unpublish overlays). Also fixes the sort order of variants displayed in the overlays (were previously in reverse alphabetical order, now in alpha order).
Change replace all underscore methods with native JS, and makes some general improvements (avoids iterating collections multiple times where possible, syntax fixes etc). Functionally, nothing has changed.
Testing requirement is to verify everything still works. Can save, publish, save+publish, unpublish, schedule with variant and invariant content. Changes are pretty safe and predictable as most relate to iterating the variants collection, which is always an array even if content is invariant.
There's a lot of duplication across these controllers, as there's a lot of common functionality (sorting, filtering) which would be really good to refactor. Hypothetically (😃) Typescript would make this more manageable as a variant object could become a variant class with its own methods, so duplicated controller functions would no longer be required to check properties as the variant would provide those values...
Oh so lovely!