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

Fix AMP version comment pages URL for legacy paired URL structure. #6389

Merged
merged 21 commits into from Jun 17, 2021

Conversation

dhaval-parekh
Copy link
Collaborator

Summary

To address the issue of invalid redirect for the AMP version comment page for legacy paired URL structure.

Fixes #6355

Checklist

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

@dhaval-parekh dhaval-parekh self-assigned this Jun 16, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Jun 16, 2021

Plugin builds for d769474 are ready 🛎️!

Copy link
Contributor

@pierlon pierlon left a comment

Choose a reason for hiding this comment

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

Great work @dhaval-parekh! Just a few minor changes to be made.

src/PairedRouting.php Outdated Show resolved Hide resolved
src/PairedRouting.php Outdated Show resolved Hide resolved
src/PairedRouting.php Outdated Show resolved Hide resolved
tests/php/src/PairedRoutingTest.php Outdated Show resolved Hide resolved
westonruter and others added 4 commits June 16, 2021 16:17
Co-authored-by: Pierre Gordon <16200219+pierlon@users.noreply.github.com>
Co-authored-by: Pierre Gordon <16200219+pierlon@users.noreply.github.com>
Co-authored-by: Pierre Gordon <16200219+pierlon@users.noreply.github.com>
Co-authored-by: Pierre Gordon <16200219+pierlon@users.noreply.github.com>
src/PairedRouting.php Outdated Show resolved Hide resolved
src/PairedRouting.php Outdated Show resolved Hide resolved
src/PairedRouting.php Outdated Show resolved Hide resolved
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

…legacy-reader-paired-url

* 'develop' of github.com:ampproject/amp-wp: (56 commits)
  Fix path regex for QA plugin workflow
  Fix script path
  Fix syntax error
  Also apply modified paths restrictions for QA tester plugin workflow
  Fix patterns
  Only run jobs when related files are modified
  Rename step
  Update Gutenberg package dependencies
  Omit Bento from components when version is not valid
  Update spec to include ampproject/amphtml#34769
  Update Gutenberg package dependencies
  Set null state
  Require polyfill directly
  Replace deprecated `@babel/polyfill` with `@wordpress/babel-preset-default/build/polyfill`
  Parse result into array
  Close latest Gutenberg dependency update PR if it is outdated
  Enable auto merge if needed
  Remove dependency approve list
  Switch to `google-github-actions/setup-gcloud` action
  Fix lint error
  ...
…legacy-reader-paired-url

* 'develop' of github.com:ampproject/amp-wp:
  Bump grunt from 1.4.0 to 1.4.1 in /qa-tester
  Bump codecov/codecov-action from 1.5.0 to 1.5.2
  Bump cweagans/composer-patches from 1.7.0 to 1.7.1
  Bump @wordpress/eslint-plugin from 9.0.5 to 9.0.6 in /qa-tester
  Bump eslint from 7.26.0 to 7.28.0
  Bump grunt from 1.4.0 to 1.4.1
  Bump php-stubs/wordpress-stubs from 5.7.1 to 5.7.2
  Bump google/cloud-storage from 1.23.1 to 1.23.2
  Bump postcss-loader from 4.2.0 to 4.3.0
Comment on lines -28 to +31
$post_id = $this->url_to_postid( $url );
// Make sure any existing AMP endpoint is removed.
$url = $this->remove_endpoint( $url );

$post_id = $this->url_to_postid( $url );
Copy link
Member

Choose a reason for hiding this comment

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

Previously when an AMP endpoint was being supplied, $post_id would always be 0 since it wouldn't be recognized. So removing the endpoint first ensures that url_to_postid works as expected.

Copy link
Member

Choose a reason for hiding this comment

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

I've added the missing assertions which would have caught this in 28b3fbf.

@westonruter westonruter force-pushed the bug/6355-legacy-reader-paired-url branch from c7c9d03 to 28b3fbf Compare June 17, 2021 18:12
Comment on lines +68 to +73
$this->assertEquals(
trailingslashit( trailingslashit( $post_permalink_url ) . $slug ),
$this->instance->add_endpoint( trailingslashit( $post_permalink_url ) . $slug )
);
$this->assertEquals( 2, $amp_pre_get_permalink_count );
$this->assertEquals( 2, $amp_get_permalink_count );
Copy link
Member

Choose a reason for hiding this comment

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

Before acf8a17 these assertions would fail.

@westonruter westonruter requested a review from pierlon June 17, 2021 18:27
@westonruter westonruter modified the milestones: v2.2, v2.1.3 Jun 17, 2021
@westonruter westonruter merged commit d9954aa into develop Jun 17, 2021
@westonruter westonruter deleted the bug/6355-legacy-reader-paired-url branch June 17, 2021 22:05
westonruter added a commit that referenced this pull request Jun 17, 2021
)

Co-authored-by: Dhaval Parekh <dmparekh007@gmail.com>
Co-authored-by: Pierre Gordon <16200219+pierlon@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Paired AMP URLs for comment pages result in 404s when Legacy Reader paired URL structure is selected
3 participants