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

SIT-2911: document default response for Sophi empty post array #307

Merged
merged 4 commits into from Jun 28, 2022

Conversation

jeffpaul
Copy link
Contributor

Description of the Change

This corrects the 1.0.9 changelog references and adds mentions into the readmes for the default handling of an empty Post ID array response from the Sophi API.

Closes #302.

Alternate Designs

n/a

Possible Drawbacks

none identified

Verification Process

Preview via GitHub or VSCode markdown previewer.

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • [xc] I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests passed.

Changelog Entry

Added - Documentation on default handling of Sophi API empty array response.

Credits

Props @jeffpaul, @oscarssanchez.

@jeffpaul jeffpaul added this to the 1.2.0 milestone Jun 22, 2022
@jeffpaul jeffpaul self-assigned this Jun 22, 2022
@jeffpaul
Copy link
Contributor Author

@jeffpaul jeffpaul changed the title Docs/302 SIT-2911: document default response for Sophi empty post array Jun 22, 2022
@jeffpaul
Copy link
Contributor Author

@oscarssanchez could use a quick review from you to ensure the way I've worded things makes sense.

CHANGELOG.md Outdated
@@ -98,9 +98,10 @@ All notable changes to this project will be documented in this file, per [the Ke
## [1.0.9] - 2022-02-18
### Added
- `hostname` and `path` fields to schema (props [@Rahmon](https://github.com/Rahmon), [@dinhtungdu](https://github.com/dinhtungdu) via [#164](https://github.com/globeandmail/sophi-for-wordpress/pull/164)).
- `found_posts` filter to modify the Sophi API response to allow manual posts to be injected into the response (e.g., via a fallback method to inject posts that would be a good fit) (props [@oscarssanchez](https://github.com/oscarssanchez), [@barryceelen](https://github.com/barryceelen), [@felipeelia](https://github.com/felipeelia) via [#183](https://github.com/globeandmail/sophi-for-wordpress/pull/183)).
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @jeffpaul the filter is actuallly sophi_curated_post_list https://github.com/globeandmail/sophi-for-wordpress/blob/9f768bf5341cacf97ccf9ba5813ed61138b88246/includes/classes/SiteAutomation/Integration.php#L113

A dev would not really be injecting posts into the Sophi response, but rather inject them previous to returning the filtered value from posts_pre_query https://github.com/globeandmail/sophi-for-wordpress/blob/9f768bf5341cacf97ccf9ba5813ed61138b88246/includes/classes/SiteAutomation/Integration.php#L31

README.md Outdated
@@ -163,6 +165,10 @@ Object caching is encouraged, as the plugin saves Sophi data as a transient. If

The default caching period is five minutes. This can be modified with the `sophi_cache_duration` hook.

### Sophi API empty response

If the Sophi API returns an empty Post ID array, the plugin will result in a "no results" response. The `found_posts` filter can be used to modify the Sophi API response to allow manual posts to be injected into the response (e.g., via a fallback method to inject posts that would be a good fit).
Copy link
Contributor

Choose a reason for hiding this comment

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

This would be the same filter sophi_curated_post_list. found_posts can be used as a reference for devs, this is actually an override from WP_Query. For example, if the response from Sophi is the empty array, found_posts would be 0 (and they can have more certainty we got an empty array)

@jeffpaul
Copy link
Contributor Author

@oscarssanchez mind pushing a commit to update those two items?

@sonarcloud
Copy link

sonarcloud bot commented Jun 28, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@jeffpaul jeffpaul merged commit 8317f1d into develop Jun 28, 2022
@jeffpaul jeffpaul deleted the docs/302 branch June 28, 2022 18:57
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.

SIT-2911: confirm and document resulting plugin behavior on empty Sophi responses
2 participants