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

Site Settings API: Expose show_context and show_date options #28251

Closed
wants to merge 51 commits into from

Conversation

mashikag
Copy link
Contributor

@mashikag mashikag commented Jan 10, 2023

Fixes Automattic/wp-calypso#71593

It is necessary to expose those options to implement the Related posts setting in the new Reading Settings page.

Proposed changes:

  • Extend site settings API to expose show_context and show_date related posts options for both reading (GET /sites/%s/settings) and writing (POST /sites/%s/settings)

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

Does this pull request change what data or activity we track or use?

No

Testing instructions:

  • Apply the PR to your sandbox
  • Sandbox public-api.wordpress.com
  • Go to wpcom API developer console

Testing POST /sites/%s/settings/

  • Select WP.COM API - v1.1 - POST - /sites/$site/settings where $site can be your test site's domain or site ID
  • Set show_context and/or show_date body args to either true or false
  • Execute the call
  • Validate the response
  • You may double check the values were persisted by executing the GET /sites/%s/settings/. See below for instructions.

Testing GET /sites/%s/settings/

  • Select WP.COM API - v1.1 - GET - /sites/$site/settings where $site can be your test site's domain or site ID
  • Execute the call
  • Validate the response. Ensure the jetpack_relatedposts_show_context and the jetpack_relatedposts_show_date are returned with the correct values

@mashikag mashikag self-assigned this Jan 10, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jan 10, 2023

Are you an Automattician? You can now test your Pull Request on WordPress.com. On your sandbox, run bin/jetpack-downloader test jetpack update/expose-related-posts-show-date-option to get started. More details: p9dueE-5Nn-p2

@mashikag mashikag requested a review from a team January 10, 2023 10:36
@github-actions github-actions bot added [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Status] In Progress [Status] Needs Test Review [Feature] WPCOM API labels Jan 10, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jan 10, 2023

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ⚠️ All commits were linted before commit.
  • ✅ Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available.


Once your PR is ready for review, check one last time that all required checks (other than "Required review") appearing at the bottom of this PR are passing or skipped.
Then, add the "[Status] Needs Team review" label and ask someone from your team review the code.
Once you’ve done so, switch to the "[Status] Needs Review" label; someone from Jetpack Crew will then review this PR and merge it to be included in the next Jetpack release.


Jetpack plugin:

  • Next scheduled release: February 7, 2023.
  • Scheduled code freeze: January 31, 2023.

Backup plugin:

  • Next scheduled release: February 7, 2023.
  • Scheduled code freeze: January 31, 2023.

Boost plugin:

  • Next scheduled release: February 7, 2023.
  • Scheduled code freeze: January 30, 2023.

Search plugin:

  • Next scheduled release: February 7, 2023.
  • Scheduled code freeze: January 30, 2023.

Social plugin:

  • Next scheduled release: February 7, 2023.
  • Scheduled code freeze: January 31, 2023.

Starter Plugin plugin:

  • Next scheduled release: February 7, 2023.
  • Scheduled code freeze: January 30, 2023.

Protect plugin:

  • Next scheduled release: February 7, 2023.
  • Scheduled code freeze: January 30, 2023.

Videopress plugin:

  • Next scheduled release: February 7, 2023.
  • Scheduled code freeze: January 30, 2023.

adimoldovan and others added 2 commits January 10, 2023 12:56
* Remove selection of complete plan in connection flow as it's broken and not used anywhere anyway.
@mashikag mashikag marked this pull request as ready for review January 10, 2023 12:11
* VideoPress: Add selector for privacy in edit page

* changelog
Copy link
Contributor

@ivan-ottinger ivan-ottinger left a comment

Choose a reason for hiding this comment

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

Nice! Works as expected. 🙂👍🏼

Details:

  • Tested on Simple, Jetpack and Atomic (both GET and POST for each)
  • Shared one tiny suggestion in a comment below.
  • Did not notice any PHP errors / warnings.
  • We noticed that when we change e.g. show_context to false, it will switch show_headline and show_thumbnails to false as well. This is currently expected behavior, although probably better addressed in a different PR - as we discussed in p1673355980792549/1673349549.496449-slack-C02TCEHP3HA.

…-show-date-option

Co-authored-by: Ivan Ottinger <25105483+ivan-ottinger@users.noreply.github.com>
@ivan-ottinger ivan-ottinger self-requested a review January 10, 2023 14:14
ivan-ottinger
ivan-ottinger previously approved these changes Jan 10, 2023
@ivan-ottinger ivan-ottinger added [Status] Needs Review To request a review from Crew. Label will be renamed soon. and removed [Status] Needs Team Review labels Jan 10, 2023
retrofox and others added 2 commits January 10, 2023 15:20
* [not verified] set Video URL based on privacy

* changelog

* fix private URL
ivan-ottinger
ivan-ottinger previously approved these changes Jan 10, 2023
@github-actions github-actions bot added [Package] Publicize [Package] Redirect [Package] Roles [Package] Search Contains core Search functionality for Jetpack and Search plugins [Package] Stats Data [Package] Stats Admin [Package] Status [Package] Sync [Package] VideoPress [Package] WAF [Plugin] Backup A plugin that allows users to save every change and get back online quickly with one-click restores. [Plugin] Boost A feature to speed up the site and improve performance. [Plugin] Protect A plugin with features to protect a site: brute force protection, security scanning, and a WAF. [Plugin] Search A plugin to add an instant search modal to your site to help visitors find content faster. [Plugin] Social Issues about the Jetpack Social plugin [Plugin] Starter Plugin [Plugin] VideoPress A standalone plugin to add high-quality VideoPress videos to your site. Actions GitHub actions used to automate some of the work around releases and repository management E2E Tests [Feature] Extra Sidebar Widgets RNA [Feature] Shortcodes / Embeds [Feature] Theme Tools [Feature] Tiled Gallery A different way to display image galleries on your site, in different organizations and shapes. labels Jan 11, 2023
@mashikag
Copy link
Contributor Author

OMG 🤦‍♂️

@ivan-ottinger and @jeherve I am so sorry for this mayhem I have caused with my late night (trying to make myself feel better) latest trunk rebase.

This PR branch just became too big of a mess to be fixing it here. Instead I have just created a new branch out of my last commit I did before the fatal rebase.

The new PR: #28305

@mashikag mashikag closed this Jan 11, 2023
auto-merge was automatically disabled January 11, 2023 21:21

Pull request was closed

@github-actions github-actions bot removed the [Status] Ready to Merge Go ahead, you can push that green button! label Jan 11, 2023
@ivan-ottinger
Copy link
Contributor

No worries, Maciej! I am going to take a look at the new PR. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Actions GitHub actions used to automate some of the work around releases and repository management [Block] AI Image [Block] AI Paragraph [Block] Contact Form Form block (also see Contact Form label) [Block] Tiled Gallery E2E Tests [Feature] Extra Sidebar Widgets [Feature] Related Posts [Feature] Shortcodes / Embeds [Feature] Theme Tools [Feature] Tiled Gallery A different way to display image galleries on your site, in different organizations and shapes. [Feature] WPCOM API [JS Package] Babel Plugin Replace Textdomain [JS Package] Components [JS Package] Config [JS Package] Connection [JS Package] I18n Check Webpack Plugin [JS Package] IDC [JS Package] Licensing [JS Package] Partner Coupon [JS Package] Publicize Components [JS Package] Shared Extension Utils [JS Package] Storybook [JS Package] Webpack Config [Package] A8c Mc Stats [Package] Action Bar This package no longer exists in the monorepo. [Package] Ad aka WordAds [Package] Admin Ui [Package] Assets [Package] Autoloader [Package] Backup [Package] Blaze [Package] Blocks [Package] Changelogger [Package] Connection [Package] Device Detection [Package] Identity Crisis This package no longer exists in the monorepo. It was merged into [Package] Connection. [Package] Jitm [Package] Licensing [Package] My Jetpack [Package] Password Checker [Package] Publicize [Package] Redirect [Package] Roles [Package] Search Contains core Search functionality for Jetpack and Search plugins [Package] Stats Admin [Package] Stats Data [Package] Status [Package] Sync [Package] VideoPress [Package] WAF [Plugin] Backup A plugin that allows users to save every change and get back online quickly with one-click restores. [Plugin] Boost A feature to speed up the site and improve performance. [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] Protect A plugin with features to protect a site: brute force protection, security scanning, and a WAF. [Plugin] Search A plugin to add an instant search modal to your site to help visitors find content faster. [Plugin] Social Issues about the Jetpack Social plugin [Plugin] Starter Plugin [Plugin] VideoPress A standalone plugin to add high-quality VideoPress videos to your site. RNA [Status] Needs Test Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reading Settings: Expose related posts show_date and show_context option in /sites/%s/settings endpoint