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

Themes: Fix theme url to include the correct image resized url #16914

Merged
merged 9 commits into from
Aug 4, 2021

Conversation

enejb
Copy link
Contributor

@enejb enejb commented Jul 22, 2021

This PR fixes the URL that we genetate to display the theme screenshots.

Before: https://i2.wp.com/s2.wp.com/wp-content/themes/pub/blank-canvas/screenshot.png?ssl=1?w=409
After: https://i2.wp.com/s2.wp.com/wp-content/themes/pub/blank-canvas/screenshot.png?ssl=1&w=409

The fix should download smaller images for each of the themes saving bandwidth and mobile data.

This issue was discoverd while trying to clear the screenshot image cache for the blank-canvas theme.

To test:
Navigate to the theme selection screen for a .com site. Notice that the screenshots show up as expected.
.org sites do not have the theme selection as an option.
Navigate to an atomic and jetpack site notice that the themes show up as expected.

Regression Notes

  1. Potential unintended areas of impact
    None that I can think of

  2. What I did to test those areas of impact (or what existing automated tests I relied on)
    N/A

  3. What automated tests I added (or what prevented me from doing so)
    None

PR submission checklist:

  • I have completed the Regression Notes.
  • I have considered adding unit tests for my changes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@enejb enejb added the Themes label Jul 22, 2021
@enejb enejb requested a review from chipsnyder July 22, 2021 21:58
@enejb enejb self-assigned this Jul 22, 2021
@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Jul 22, 2021

You can trigger an installable build for these changes by visiting CircleCI here.

@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Jul 22, 2021

You can trigger optional UI/connected tests for these changes by visiting CircleCI here.

Copy link
Contributor

@chipsnyder chipsnyder left a comment

Choose a reason for hiding this comment

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

Hey @enejb, great job discovering this issue and proposing a solution. I made a couple of NitPick suggestions and offered up some readability improvements in addition it looks like there is a force unwrap case from the original code that we can probably clean up while we're making this change.

@enejb
Copy link
Contributor Author

enejb commented Jul 23, 2021

Thanks for all your help @chipsnyder
Can you take another look when you have a moment?

@enejb enejb requested a review from chipsnyder July 23, 2021 21:09
}

var queryItems: [URLQueryItem] = components.queryItems ?? []
queryItems.append(URLQueryItem(name: "w", value: "\(presenter!.screenshotWidth)"))
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should handle this presenter! by conditionally unwrapping.

I can push a change here though since I know you're away this week.

Copy link
Contributor

@chipsnyder chipsnyder left a comment

Choose a reason for hiding this comment

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

I pushed the change for the small refactor I wanted to see the rest looks good to me. Thanks for handling this Enej!

@chipsnyder chipsnyder merged commit aa03f18 into develop Aug 4, 2021
@chipsnyder chipsnyder deleted the fix/themes-screenshots-url branch August 4, 2021 20:14
@peril-wordpress-mobile
Copy link

Warnings
⚠️ PR is not assigned to a milestone.

Generated by 🚫 dangerJS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants