Skip to content
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

Simplify internal metadata API #584

Merged
merged 60 commits into from
Oct 26, 2022
Merged

Simplify internal metadata API #584

merged 60 commits into from
Oct 26, 2022

Conversation

caendesilva
Copy link
Member

@caendesilva caendesilva commented Oct 25, 2022

Right now we have two overlapping services handling metadata (actually three since the Site class does some logic), this is of course not good for maintainability.

This PR reduces complexity, refactors the code, and adds a new class called GlobalMetadataBag to shift those responsibilities the area of concerns for the other metadata classes. It also moves some logic from the Meta facade/helper to the Metadatabag class.

The new GlobalMetadataBag class, when filtering duplicates, will see if there is a current page being rendered, and then diff out those to fix #536.

@codecov
Copy link

codecov bot commented Oct 25, 2022

Codecov Report

Merging #584 (6cdade1) into master (dd40cb2) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

@@             Coverage Diff              @@
##             master     #584      +/-   ##
============================================
- Coverage     99.95%   99.95%   -0.01%     
+ Complexity      975      974       -1     
============================================
  Files           112      114       +2     
  Lines          2418     2409       -9     
============================================
- Hits           2417     2408       -9     
  Misses            1        1              
Impacted Files Coverage Δ
packages/framework/src/Concerns/HydePage.php 100.00% <100.00%> (ø)
packages/framework/src/Helpers/Meta.php 100.00% <100.00%> (ø)
packages/framework/src/Models/Support/Site.php 100.00% <100.00%> (ø)
...amework/src/Modules/Metadata/GlobalMetadataBag.php 100.00% <100.00%> (ø)
...ges/framework/src/Modules/Metadata/MetadataBag.php 100.00% <100.00%> (ø)
...framework/src/Modules/Metadata/PageMetadataBag.php 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@caendesilva caendesilva added this to the v1 milestone Oct 25, 2022
caendesilva and others added 4 commits October 25, 2022 20:38
Reference is unnecessary because the argument is neither assigned nor further passed by reference
@caendesilva
Copy link
Member Author

The global metadata bag inherits some helpers that are not really required, maybe we should split out those to a page metadata bag?

Also, update release notes.

@caendesilva caendesilva marked this pull request as ready for review October 26, 2022 10:00
@caendesilva caendesilva merged commit fe113db into master Oct 26, 2022
@caendesilva caendesilva deleted the code-refactors branch October 26, 2022 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove duplicate metadata from page model
2 participants