Skip to content

Discontinue doing synchronous validation requests upon activating plugins #5101

@westonruter

Description

@westonruter

Feature description

Depends on #4719.

Relates to #2069.

In #5100 no longer is a synchronous validation request performed when switching template modes. However, what remains is the synchronous validation request when activating plugins.

The validation errors are obtained in AMP_Validation_Manager::validate_after_plugin_activation() and then displayed via AMP_Validation_Manager::print_plugin_notice().

Instead, upon activating a plugin when the “Plugin activated” notice is displayed:

image

There should at that point also be an admin notice from the AMP plugin which is accompanied by an enqueued script which does an asynchronous request to check the site for validation issues. A spinner should be shown along with a message saying “checking for AMP compatibility issues”. Then once the results are back, a message can be shown saying there is no validation errors or that there are errors present with those activated plugins, and a link to see what they are.

As it is currently, this admin notice should probably be suppressed if the user doesn't have developer tools enabled.

There could also be a good tie-in here with Plugin Suppression to allow a user to easily deactivate the plugins on AMP responses.

Relates to wizard compatibility scanning in #4795 and #4719.


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

Implementation brief

  1. All existing server-side synchronous logic is removed.
  2. Upon selecting to activate a plugin, the user is immediately taken to the resulting page with the normal "Plugin activated" notice shown.
  3. On the resulting page, another "Plugin scanning" notice is displayed with a loading spinner.
  4. REST API requests are initiated to do a site scan (Wizard Step: Plugin compatibility scanning #4719).
  5. The plugin sources for unreviewed invalid markup are then aggregated from the REST API responses.
  6. If there are plugin sources for unreviewed invalid markup:
    1. Give the notice a warning class.
    2. List out the plugins which are causing unreviewed validation errors.
    3. List out the validated URLs on which the errors occur. (The validated URLs on which a plugin's errors occur should probably be listed under the plugin itself.)
    4. Link to Plugin Suppression screen so user has ability to prevent plugins from running on AMP pages. (It's likely overkill to provide a way to suppress plugins directly from this notice.)
  7. If there are no unreviewed validation errors, then the notice should be given a success class.

QA testing instructions

Demo

Changelog entry

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions