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

Move generic site data into self contained objects. #21368

Conversation

thijsoo
Copy link
Contributor

@thijsoo thijsoo commented May 6, 2024

Context

  • We want to refactor our script data and put all site information in one place.

Summary

This PR can be summarized in the following changelog entry:

  • Refactors site information script data.

Relevant technical choices:

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

  • Without this PR open a post and category. Add the following to your console and mark down the result:
wpseoScriptData.dismissedAlerts
wpseoScriptData.currentPromotions
wpseoScriptData.webinarIntroBlockEditorUrl
wpseoScriptData.blackFridayBlockEditorUrl
wpseoScriptData.linkParams
wpseoScriptData.pluginUrl
wpseoScriptData.wistiaEmbedPermission

wpseoScriptData.metabox.site_name
wpseoScriptData.metabox.contentLocale
wpseoScriptData.metabox.userLocale
wpseoScriptData.metabox.isRtl
wpseoScriptData.metabox.isPremium
wpseoScriptData.metabox.siteIconUrl
wpseoScriptData.metabox.search_url
wpseoScriptData.metabox.post_edit_url
wpseoScriptData.metabox.base_url

Only

wpseoScriptData.dismissedAlerts
wpseoScriptData.currentPromotions
wpseoScriptData.webinarIntroBlockEditorUrl
wpseoScriptData.blackFridayBlockEditorUrl

wpseoScriptData.metabox.search_url
wpseoScriptData.metabox.post_edit_url
wpseoScriptData.metabox.base_url

Should be different between posts and terms.
The top 4 should not exist on terms.

  • With the PR do this again and make sure the results are the same.

Relevant test scenarios

  • Changes should be tested with the browser console open
  • Changes should be tested on different posts/pages/taxonomies/custom post types/custom taxonomies
  • Changes should be tested on different editors (Default Block/Gutenberg/Classic/Elementor/other)
  • Changes should be tested on different browsers
  • Changes should be tested on multisite

Test instructions for QA when the code is in the RC

  • QA should use the same steps as above.

QA can test this PR by following these steps:

Impact check

This PR affects the following parts of the plugin, which may require extra testing:

UI changes

  • This PR changes the UI in the plugin. I have added the 'UI change' label to this PR.

Other environments

  • This PR also affects Shopify. I have added a changelog entry starting with [shopify-seo], added test instructions for Shopify and attached the Shopify label to this PR.

Documentation

  • I have written documentation for this change. For example, comments in the Relevant technical choices, comments in the code, documentation on Confluence / shared Google Drive / Yoast developer portal, or other.

Quality assurance

  • I have tested this code to the best of my abilities.
  • During testing, I had activated all plugins that Yoast SEO provides integrations for.
  • I have added unit tests to verify the code works as intended.
  • If any part of the code is behind a feature flag, my test instructions also cover cases where the feature flag is switched off.
  • I have written this PR in accordance with my team's definition of done.
  • I have checked that the base branch is correctly set.

Innovation

  • No innovation project is applicable for this PR.
  • This PR falls under an innovation project. I have attached the innovation label.
  • I have added my hours to the WBSO document.

Fixes #

@thijsoo thijsoo added the changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog label May 6, 2024
@thijsoo thijsoo linked an issue May 6, 2024 that may be closed by this pull request
@thijsoo thijsoo marked this pull request as ready for review May 7, 2024 10:16
@coveralls
Copy link

coveralls commented May 7, 2024

Pull Request Test Coverage Report for Build c14d9cacb5591800e88e09c1ae4db325be0d9b75

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 85 of 131 (64.89%) changed or added relevant lines in 6 files are covered.
  • 1008 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.004%) to 50.425%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/editors/framework/site/term-site-information.php 34 35 97.14%
src/editors/framework/site/post-site-information.php 47 49 95.92%
src/editors/application/site/website-information-repository.php 0 7 0.0%
admin/metabox/class-metabox.php 0 11 0.0%
src/editors/framework/site/base-site-information.php 0 25 0.0%
Files with Coverage Reduction New Missed Lines %
src/generated/container.php 1008 0.16%
Totals Coverage Status
Change from base Build 5596f6efc499e2e6f3a0eb6beba30bfbcb912a83: 0.004%
Covered Lines: 16077
Relevant Lines: 31883

💛 - Coveralls

Copy link
Contributor

@leonidasmi leonidasmi left a comment

Choose a reason for hiding this comment

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

CR: ❌

Also, the metabox is broken:
image

src/editors/domain/site/site-information-interface.php Outdated Show resolved Hide resolved
admin/metabox/class-metabox.php Outdated Show resolved Hide resolved
admin/metabox/class-metabox.php Outdated Show resolved Hide resolved
admin/taxonomy/class-taxonomy.php Outdated Show resolved Hide resolved
src/editors/framework/site/base-site-information.php Outdated Show resolved Hide resolved
admin/metabox/class-metabox.php Outdated Show resolved Hide resolved
thijsoo and others added 3 commits May 30, 2024 11:42
… into 21351-refactor-website-specific-scriptdata-to-its-own-object

# Conflicts:
#	admin/formatter/class-metabox-formatter.php
#	admin/formatter/class-post-metabox-formatter.php
#	admin/formatter/class-term-metabox-formatter.php
#	composer.json
#	tests/WP/Formatter/Metabox_Formatter_Test.php
@igorschoester igorschoester changed the base branch from trunk to feature/plugin-fixes July 1, 2024 13:30
The mocks in the trait did not work for terms since the counts were off.
This seems like the actual fix.
Note: I took the freedom to ensure the base uses protected on the dependencies. But private in the post/term ones.
@igorschoester igorschoester added this to the feature/plugin-fixes milestone Jul 1, 2024
@igorschoester igorschoester merged commit 583e1ed into feature/plugin-fixes Jul 1, 2024
22 checks passed
@igorschoester igorschoester deleted the 21351-refactor-website-specific-scriptdata-to-its-own-object branch July 1, 2024 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor website specific scriptdata to its own object
5 participants