Repository navigation
fix(endpoint-micropub): honour filter on q=source, add category - #991
Merged
Merged
Conversation
The README promises `filter` for every list query and gives `/micropub?q=source&filter=web` as the example, but the source query ignored it: the parameter only ever reached the configuration queries. Honour it for posts as a case-insensitive match on the name and content, and accept `category` alongside it for posts carrying that category. Filtering keeps paging: getCursor takes an optional query that is merged into the range condition and into the hasNext/hasPrev probes, so a filtered page reports whether more filtered items exist rather than whether more items exist at all. Existing callers are unaffected; the parameter defaults to an empty object. Tests cover the cursor filter in util, and for the endpoint: match by name, match by content, match by category, both together across two pages, and no match.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #990.
filteris a case-insensitive match on a post's name or content,categoryan exact category; both are cast to strings so nothing reaches the database as an operator, and both are passed togetCursoras its filter so paging keeps working within the match (the cursor'sfilteroption landed with #944).Four integration tests, seen failing first. README documents
category.This is one of the last six changes ported from my fork; nothing here needs to hold a release.