Skip to content

Improve handling of Stories in Compatibility Tool#3329

Merged
westonruter merged 2 commits intodevelopfrom
fix/amp-story-validation
Sep 24, 2019
Merged

Improve handling of Stories in Compatibility Tool#3329
westonruter merged 2 commits intodevelopfrom
fix/amp-story-validation

Conversation

@westonruter
Copy link
Copy Markdown
Member

@westonruter westonruter commented Sep 23, 2019

In #3321 it was discovered that rejecting the sanitization of a validation error on an AMP Story results in an infinite redirect when a site is not in Standard mode. When processing a Story, it should behave as if the site is in Standard mode. No redirection should be performed when there are rejected validation errors, but rather the amp attribute should be removed from the page to prevent it from being validated as a valid AMP page.

In the same way, when a Story is listed among the Validated URLs in the admin, there should be no ?amp appearing in the displayed URLs.

Testing instructions:

  1. Set mode to Transitional.
  2. Create a Story and add a Custom HTML block with some invalid AMP markup, like <script>bad</script>
  3. Publish Story.
  4. A warning message should appear about validation errors. Click “Review Issues”.
  5. With this ifx applied, the Validated URL screen should not show ?amp in the heading.
  6. On the Validated URL screen, set the validation error status as “Rejected” instead of “New Accepted”. Press Update.
  7. Try navigating to the permalink of the post, and the Story should render but not as a valid AMP page; the Custom HTML markup should appear in the page, and the html element should have the amp attribute omitted.

Before

image

Viewing the story:

image

After

image

Viewing the story:

image

@westonruter westonruter added this to the v1.3 milestone Sep 23, 2019
@googlebot googlebot added the cla: yes Signed the Google CLA label Sep 23, 2019
@westonruter westonruter marked this pull request as ready for review September 23, 2019 22:23
@westonruter westonruter mentioned this pull request Sep 23, 2019
7 tasks
@kienstra
Copy link
Copy Markdown
Contributor

Approved

Hi @westonruter,
This looks good! Great debugging on #3321.

Like you mentioned, I also saw that there were too many redirects when a validation error for a story was rejected:

too-many-redirects

But with this PR, the AMP story with the rejected error appears as expected:
amp-story-without-error

@westonruter westonruter merged commit 7f0a97c into develop Sep 24, 2019
@westonruter westonruter deleted the fix/amp-story-validation branch September 24, 2019 04:14
westonruter added a commit that referenced this pull request Sep 24, 2019
westonruter added a commit that referenced this pull request Sep 24, 2019
@swissspidy
Copy link
Copy Markdown
Collaborator

See issue description above for testing instructions

@csossi
Copy link
Copy Markdown

csossi commented Oct 1, 2019

Warning message isn't appearing after "Publish"
image

But if I leave the story and return, then it appears:
image

@csossi csossi assigned kienstra and unassigned csossi and kienstra Oct 1, 2019
@westonruter
Copy link
Copy Markdown
Member Author

@csossi I was seeing this as well. However, I just tried in the latest 6.6.0-RC1 of Gutenberg, and I'm not seeing it. When creating a post or a story with invalid markup, it is showing me the warning upon the first save:

image

image

@swissspidy
Copy link
Copy Markdown
Collaborator

Verified this as per the testing instructions 👍

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants