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

Use allow-list for mobile editor settings endpoint #56424

Draft
wants to merge 11 commits into
base: trunk
Choose a base branch
from

Conversation

mkevins
Copy link
Contributor

@mkevins mkevins commented Nov 22, 2023

Description

This PR introduces an "allow-list" for the mobile endpoint for block editor settings. This gives us a greater degree of control over what the client apps are consuming, and helps avoid prematurely introducing changes which do not yet have support in the mobile apps.

What?

Why?

How?

Testing Instructions

Testing Instructions for Keyboard

Screenshots or screencast

Copy link

github-actions bot commented Nov 22, 2023

This pull request has changed or added PHP files. Please confirm whether these changes need to be synced to WordPress Core, and therefore featured in the next release of WordPress.

If so, it is recommended to create a new Trac ticket and submit a pull request to the WordPress Core Github repository soon after this pull request is merged.

If you're unsure, you can always ask for help in the #core-editor channel in WordPress Slack.

Thank you! ❤️

View changed files
❔ lib/experimental/block-editor-settings-mobile-allowed.php
❔ lib/load.php

Copy link

github-actions bot commented Nov 22, 2023

Flaky tests detected in 9c19187.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/6966908351
📝 Reported issues:

@dcalhoun dcalhoun added the [Type] Experimental Experimental feature or API. label Nov 22, 2023
Copy link
Member

@dcalhoun dcalhoun left a comment

Choose a reason for hiding this comment

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

I took the liberty of refactoring and formatting the code to address the lint errors and warning, as the number of inline errors made review a bit difficult.

I have not yet tested the code, but at a cursory glance the changes seems sound to me.

lib/experimental/block-editor-settings-mobile.php Outdated Show resolved Hide resolved
lib/experimental/block-editor-settings-mobile.php Outdated Show resolved Hide resolved
If the settings do not include an item listed in the allow list, we must
avoid an attempt to reference the non-existent settings key.
This appears to be expected by the existing tests. However, it is
unclear if all or a subset of the nested keys are expected or required.
@mkevins
Copy link
Contributor Author

mkevins commented Nov 23, 2023

Thank you @dcalhoun for your review (and for your helpful commits)! I've pushed a few more commits to address your feedback, so this is ready for another pass.

Note: I have not yet marked this as "ready for review" because I haven't had time to add some unit tests. But, if you have further feedback about the approach, it is welcome 🙂 .

mkevins and others added 3 commits November 24, 2023 14:13
The important part of this is that the filter is a separate filter.
Incidentally, this also fixes a bug in which the previous draft
implementation returned a filtered response even for non-mobile
contexts.
Appease linter errors via `npm run format:php`.
@dcalhoun
Copy link
Member

Thank you @dcalhoun for your review (and for your helpful commits)! I've pushed a few more commits to address your feedback, so this is ready for another pass.

Note: I have not yet marked this as "ready for review" because I haven't had time to add some unit tests. But, if you have further feedback about the approach, it is welcome 🙂 .

@mkevins the implementation looks sound to me. I do not have further feedback at this time.

I pushed a commit addressing the PHP unit test failures by running npm run format:php. The E2E test failures appear unrelated, we should likely rebase this branch atop the latest trunk to see if it resolves the failures.

From what I gathered, a version of these changes were deployed internally. So, for better or worse, I suppose further stability testing of these changes is happening live. If that appears to go well, then it increases confidence that these proposed changes include all the necessary attributes for the allow list.

'color' => true,
'typography' => true,
),
'__experimentalFeatures' => array(
Copy link
Member

Choose a reason for hiding this comment

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

Let's also add the custom attribute which is used for custom variables or other settings. The app uses it to get values for custom variables.

@antonis antonis removed their request for review April 5, 2024 08:14
@dcalhoun dcalhoun removed their request for review August 28, 2024 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Experimental Experimental feature or API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants