Fix PostPreviewSnapshot rendering #8475
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Commit 942be70 broke rendering of PostPreviewSnapshots because the post preview template now expects a serialized version of pages, not the page objects themselves.
I've updated the relevant code and added a new regression test that actually renders the PPS template, something we lacked before.
How to test this PR
To test, run a local server and visit
http://localhost:8000/compliance/amicus/
http://localhost:8000/rules-policy/notice-opportunities-comment/
These pages now once again render properly.
Notes and todos
It's strange and suboptimal that SublandingPages with PostPreviewSnapshots don't use the same page search approach that regular FilterableLists do. For example, this page looks like a FilterableList but under the hood it's using this
get_browsefilterable_posts
method that does a direct database query (with some smelly logic) instead of querying the page search index. Is there any reason why we shouldn't try to unify this code? Ping @csebianlander for any thoughts.Checklist