Skip to content

Remove validation handling option#3545

Merged
westonruter merged 11 commits intodevelopfrom
enhancement/3350-remove-validation-handling-option
Oct 18, 2019
Merged

Remove validation handling option#3545
westonruter merged 11 commits intodevelopfrom
enhancement/3350-remove-validation-handling-option

Conversation

@pierlon
Copy link
Copy Markdown
Contributor

@pierlon pierlon commented Oct 17, 2019

Summary

  • Remove validation handling setting field
  • Remove relevant auto-sanitization notices
  • Remove auto_accept_sanitization option
  • Make AMP_Validation_Manage::is_sanitization_auto_accepted() filterable via amp_validation_error_default_sanitized. See https://gist.github.com/westonruter/c1496d668b2a73a44aa423e6547a59b7.
  • Update tests to use new filter to set sanitization auto acceptance

Fixes #3350.

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).

@googlebot googlebot added the cla: yes Signed the Google CLA label Oct 17, 2019
@pierlon pierlon changed the title Enhancement/3350 remove validation handling option Remove validation handling option Oct 17, 2019

<?php if ( $forced_sanitization ) : ?>
<div class="notice notice-info notice-alt inline">
<p><?php esc_html_e( 'Your install is configured via a theme or plugin to automatically sanitize any AMP validation error that is encountered.', 'amp' ); ?></p>
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@westonruter Is this information still needed? This comes from a different filter: 'amp_validation_error_sanitized'.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good question. No, this is not needed anymore because it was only needed to explain why the checkbox is not displayed. Now that we are getting rid of the checkbox, there is no need for it.

} elseif ( AMP_Theme_Support::TRANSITIONAL_MODE_SLUG === $template_mode ) {
$message = sprintf(
/* translators: %s is a link to the AMP settings screen */
__( 'The site is using transitional AMP mode without auto-sanitization, the validation errors found require action and influence which pages are shown in AMP. For automatically handling the errors turn on auto-sanitization from <a href="%s">Validation Handling settings</a>.', 'amp' ),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@westonruter Do we still need a notice/description to explain how transitional mode works?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not here I think. I was never super happy with how we ended up adding permanent notices to the compatibility tool screens. I think the mode description should be restricted to the settings screen, or else explain contextually for each validated URL that AMP is not going to be available on it. Although we do have this to some degree currently:

image

esc_url( admin_url( 'admin.php?page=' . AMP_Options_Manager::OPTION_NAME ) )
);
} else {
$message = __( 'The site is using AMP reader mode, your theme templates are not used and the errors below are irrelevant.', 'amp' );
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@westonruter Do we still need a notice/description to explain how reader mode works?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The compatibility tool isn't directly accessible in Reader mode, so such users most likely won't even land here. Otherwise, the information about the modes should be fleshed out on the settings screen, IMO.

@schlessera schlessera added Sanitizers Enhancement New feature or improvement of an existing one labels Oct 17, 2019
@pierlon pierlon requested a review from schlessera October 17, 2019 06:40
* Supply boolean as first arg to filter, unconditional based on mode.
* Remove now-unnecessary special cade auto-acceptance logic for stories.
* Update plugin version references from 1.3.1 to 1.4.
* Add phpdoc.

<?php if ( $forced_sanitization ) : ?>
<div class="notice notice-info notice-alt inline">
<p><?php esc_html_e( 'Your install is configured via a theme or plugin to automatically sanitize any AMP validation error that is encountered.', 'amp' ); ?></p>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good question. No, this is not needed anymore because it was only needed to explain why the checkbox is not displayed. Now that we are getting rid of the checkbox, there is no need for it.

} elseif ( AMP_Theme_Support::TRANSITIONAL_MODE_SLUG === $template_mode ) {
$message = sprintf(
/* translators: %s is a link to the AMP settings screen */
__( 'The site is using transitional AMP mode without auto-sanitization, the validation errors found require action and influence which pages are shown in AMP. For automatically handling the errors turn on auto-sanitization from <a href="%s">Validation Handling settings</a>.', 'amp' ),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not here I think. I was never super happy with how we ended up adding permanent notices to the compatibility tool screens. I think the mode description should be restricted to the settings screen, or else explain contextually for each validated URL that AMP is not going to be available on it. Although we do have this to some degree currently:

image

esc_url( admin_url( 'admin.php?page=' . AMP_Options_Manager::OPTION_NAME ) )
);
} else {
$message = __( 'The site is using AMP reader mode, your theme templates are not used and the errors below are irrelevant.', 'amp' );
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The compatibility tool isn't directly accessible in Reader mode, so such users most likely won't even land here. Otherwise, the information about the modes should be fleshed out on the settings screen, IMO.

@westonruter westonruter added this to the v1.4 milestone Oct 17, 2019
@westonruter westonruter dismissed schlessera’s stale review October 17, 2019 23:43

Changes addressed

@westonruter westonruter merged commit 1f26b90 into develop Oct 18, 2019
@westonruter westonruter deleted the enhancement/3350-remove-validation-handling-option branch October 18, 2019 00:17
@westonruter
Copy link
Copy Markdown
Member

Nice work. This is a great and sweeping change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes Signed the Google CLA Enhancement New feature or improvement of an existing one Sanitizers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove validation handling options with the checkbox to disable auto-accepting sanitization

4 participants