Add --label and --author filters to pr list #130
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/113-pr-list-filters"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes the
pr listfilter gap from rasterstate/fj#113:fj pr listfiltered by state only, while
fj issue listalready takes--label/--assignee.What changed
--label NAME(repeatable / comma-separated) and--author USERNAMEon
fj pr list, threaded throughpull_core::ListOptionsand itsquery builder.
/pullsendpoint filters labels by ID, not name, so--labelresolves names to IDs up front via the existingapi::label::resolve_names_to_ids. An unknown name fails with a clearno label named '...'.--authormaps to theposterquery param, which returns a clear400 user does not existon an unknown login.--state, and composewith
--jsonand--paginate(the param builder is shared acrossboth the paged and capped fetch paths).
On --assignee
The issue also asked for
--assignee, but the Forgejo/pullsendpoint(verified against the live forge, v15.0.2) has no assignee filter:
assignee/assigned_byare silently ignored and the full list comesback. Assignee filtering for PRs only exists on the
/issues?type=pullsendpoint, whose payload has no
head/base, so routing through it wouldblank out the BRANCHES column the PR table renders. Rather than ship a
silently-broken flag or change the list's data source,
--assigneeisleft out of this PR.
Tests
pull_list_sends_label_ids_and_poster: assertslabels/posterquery params are sent.
pull_list_omits_filter_params_when_unset: asserts nolabels/posterparams when filters are empty/unset.
list_parses_label_and_author_filters: clap parsing for the new flags.cargo fmt --check, clippy (-D warnings), and cargo test --all all pass.
fj pr listcannot filter by label/assignee/author, thoughfj issue listfilters by label and assignee #108