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 Noloading toggle if block does not have specified setting #5574

Merged
merged 5 commits into from
Dec 13, 2020

Conversation

pierlon
Copy link
Contributor

@pierlon pierlon commented Nov 4, 2020

Summary

Fixes #4555

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 the WS:Core Work stream for Plugin core label 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 8a6d522 are ready 🛎️!

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.

Left a suggestion on this, @pierlon

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

if ( ! ampNoLoading ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be:

Suggested change
if ( ! ampNoLoading ) {
if ( undefined === ampNoLoading ) {

If it's just ! ampNoLoading, then the toggle will be hidden on existing blocks that have it set to false. And if an existing block has it set to true and it is toggled to false, the toggle will disappear. That's not what we intend, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea that's true, nice catch. I've addressed that in b390973.

@pierlon pierlon force-pushed the enhancement/4555-deprecate-amp-noloading-setting branch from 8832470 to b390973 Compare December 11, 2020 09:06
@codecov
Copy link

codecov bot commented Dec 11, 2020

Codecov Report

Merging #5574 (8a6d522) into develop (f6ea716) will increase coverage by 0.02%.
The diff coverage is 75.00%.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop    #5574      +/-   ##
=============================================
+ Coverage      73.62%   73.64%   +0.02%     
  Complexity      5424     5424              
=============================================
  Files            187      187              
  Lines          16364    16366       +2     
=============================================
+ Hits           12048    12053       +5     
+ Misses          4316     4313       -3     
Flag Coverage Δ Complexity Δ
javascript 65.13% <75.00%> (+0.81%) 0.00 <0.00> (ø)
php 73.89% <ø> (ø) 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 28.65% <75.00%> (+2.73%) 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.

As noted in #5573 (review), please add a deprecation notice that warns the feature will be removed.

<span dangerouslySetInnerHTML={ {
__html: sprintf(
/* translators: placeholder is link to support forum. */
__( 'The AMP Layout setting is deprecated and is slated for removal. Please <a href="%s" target="_blank" rel="noreferrer">report</a> if you need it.', 'amp' ),
Copy link
Member

Choose a reason for hiding this comment

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

This seems to be copy/pasta from #5573. Shouldn't it reference “AMP Noloading” and be put on AmpNoloadingToggle below instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it should 🤦. Resolved in d8a4e0c.

@pierlon pierlon force-pushed the enhancement/4555-deprecate-amp-noloading-setting branch from d358e75 to d8a4e0c Compare December 13, 2020 01:46
…nt/4555-deprecate-amp-noloading-setting

* 'develop' of github.com:ampproject/amp-wp:
  Add a warning notice to setting
  Add force flag to rm on the productionVendorExcludedFilePatterns
  Bump ampproject/amp-toolbox from 0.1.0 to 0.1.1
  Rename test file
  Test AmpLayoutControl
  Use stricter condition check
  Hide AMP Layout toggle if block does not have specified setting
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.

For a newly-inserted image block, there is now no Noloading setting nor any Layout setting:

image

For a block that has those settings selected, the warnings appear:

image

@westonruter westonruter merged commit ffa5481 into develop Dec 13, 2020
@westonruter westonruter deleted the enhancement/4555-deprecate-amp-noloading-setting branch December 13, 2020 04:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WS:Core Work stream for Plugin core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deprecate AMP Noloading setting
3 participants