-
Notifications
You must be signed in to change notification settings - Fork 7
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
Conversation
Note that this relates to https://voltron.atlassian.net/servicedesk/customer/portal/41/SIT-2911. |
@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)). |
There was a problem hiding this comment.
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). |
There was a problem hiding this comment.
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)
@oscarssanchez mind pushing a commit to update those two items? |
Kudos, SonarCloud Quality Gate passed! |
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:
Changelog Entry
Credits
Props @jeffpaul, @oscarssanchez.