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

Hide AMP Layout control if block does not have specified setting #5573

Merged
merged 5 commits into from
Dec 13, 2020

Conversation

pierlon
Copy link
Contributor

@pierlon pierlon commented Nov 4, 2020

Summary

Fixes #4554.

When the control is displayed, a deprecated warning notice is shown:

image

Checklist

  • My pull request is addressing an open issue (please create one otherwise).
  • My code is tested and passes existing tests.
  • My code follows the Engineering Guidelines (updates are often made to the guidelines, check it out periodically).

@pierlon pierlon added Editor WS:Core Work stream for Plugin core labels Nov 4, 2020
@pierlon pierlon added this to the v2.1 milestone Nov 4, 2020
@pierlon pierlon self-assigned this Nov 4, 2020
@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2020

Plugin builds for 4ce49d8 are ready 🛎️!

@pierlon pierlon changed the title Hide AMP Layout toggle if block does not have specified setting Hide AMP Layout control if block does not have specified setting Nov 4, 2020
Copy link
Contributor

@johnwatkins0 johnwatkins0 left a comment

Choose a reason for hiding this comment

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

Leaving the same comment here as on the other similar PR.

* @param {Object} props Props.
*
* @return {ReactElement} Element.
*/
const AmpLayoutControl = ( props ) => {
const { name, attributes: { ampLayout }, setAttributes } = props;

if ( ! ampLayout ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

See my comment here https://github.com/ampproject/amp-wp/pull/5574/files#r518529646. We probably want this check to be for undefined instead of false.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. Addressed in 5993490.

@pierlon pierlon force-pushed the enhancement/4554-deprecate-amp-layout-settings branch from 762af24 to 5993490 Compare December 8, 2020 05:56
@codecov
Copy link

codecov bot commented Dec 8, 2020

Codecov Report

Merging #5573 (4ce49d8) into develop (b6d53fc) will increase coverage by 0.20%.
The diff coverage is 50.00%.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop    #5573      +/-   ##
=============================================
+ Coverage      73.41%   73.62%   +0.20%     
- Complexity      5384     5424      +40     
=============================================
  Files            187      187              
  Lines          16236    16364     +128     
=============================================
+ Hits           11920    12048     +128     
  Misses          4316     4316              
Flag Coverage Δ Complexity Δ
javascript 64.31% <50.00%> (+2.37%) 0.00 <0.00> (ø)
php 73.89% <ø> (+0.14%) 0.00 <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ Complexity Δ
assets/src/block-editor/helpers/index.js 25.92% <50.00%> (+7.17%) 0.00 <0.00> (ø)
includes/amp-helper-functions.php 85.73% <0.00%> (-0.69%) 0.00% <0.00%> (ø%)
includes/admin/class-amp-template-customizer.php 95.27% <0.00%> (+0.09%) 76.00% <0.00%> (+2.00%)
src/MobileRedirection.php 90.34% <0.00%> (+0.13%) 56.00% <0.00%> (+1.00%)
...udes/sanitizers/class-amp-core-theme-sanitizer.php 31.92% <0.00%> (+11.45%) 226.00% <0.00%> (+37.00%)
includes/amp-post-template-functions.php 100.00% <0.00%> (+20.51%) 0.00% <0.00%> (ø%)

Copy link
Member

@westonruter westonruter left a comment

Choose a reason for hiding this comment

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

This tests well. However, there's one additional change that would be worthwhile: could you add a warning notice to precede the AMP Layout setting that says:

The AMP Layout setting is deprecated and is slated for removal. Please report if you need it.

Copy link
Member

@westonruter westonruter left a comment

Choose a reason for hiding this comment

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

Looks great.

@westonruter westonruter merged commit f6ea716 into develop Dec 13, 2020
@westonruter westonruter deleted the enhancement/4554-deprecate-amp-layout-settings branch December 13, 2020 03:42
const { name, attributes: { ampLayout }, setAttributes } = props;

if ( undefined === ampLayout ) {
Copy link
Member

Choose a reason for hiding this comment

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

Per https://wordpress.org/support/topic/seeing-a-the-amp-layout-setting-is-deprecated-on-images/ this may need to be changed to:

if ( undefined === ampLayout || '' === ampLayout ) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Editor WS:Core Work stream for Plugin core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deprecate AMP Layout settings
3 participants