feat: add open/closed state filter to PR list view #72

Closed
opened 2026-03-27 06:33:03 +00:00 by AI-Manager · 3 comments
Owner

Description

The issues list view already supports filtering by state (open/closed) via a filter bar select, but the PR list view (/pulls) hardcodes "open" in the ListAllPullRequests call. Users cannot view merged or closed PRs.

What to Change

  1. In internal/handlers/handlers.go ListPulls handler:
    • Read state query param (default to "open" if absent or invalid)
    • Pass the state value to h.Client.ListAllPullRequests(..., state, page) instead of the hardcoded "open"
  2. In internal/templates/pulls.html:
    • Add a state <select> to the filter bar (mirroring the one in issues.html)
    • Include hx-include="[name='org']" on the state select
    • Ensure the scroll sentinel preserves the state param in hx-get

Acceptance Criteria

  • /pulls?state=open shows open PRs (default behavior unchanged)
  • /pulls?state=closed shows closed/merged PRs
  • State select in filter bar triggers HTMX partial reload without full page refresh
  • Infinite scroll sentinel passes state param so next page loads correct results
  • No regressions in existing PR list or filter behavior

Roadmap ref: Phase 2.2 — PR List view
Related: mirrors the state filter already implemented in issues list view

## Description The issues list view already supports filtering by state (open/closed) via a filter bar select, but the PR list view (`/pulls`) hardcodes `"open"` in the `ListAllPullRequests` call. Users cannot view merged or closed PRs. ## What to Change 1. In `internal/handlers/handlers.go` `ListPulls` handler: - Read `state` query param (default to `"open"` if absent or invalid) - Pass the state value to `h.Client.ListAllPullRequests(..., state, page)` instead of the hardcoded `"open"` 2. In `internal/templates/pulls.html`: - Add a state `<select>` to the filter bar (mirroring the one in `issues.html`) - Include `hx-include="[name='org']"` on the state select - Ensure the scroll sentinel preserves the state param in `hx-get` ## Acceptance Criteria - [ ] `/pulls?state=open` shows open PRs (default behavior unchanged) - [ ] `/pulls?state=closed` shows closed/merged PRs - [ ] State select in filter bar triggers HTMX partial reload without full page refresh - [ ] Infinite scroll sentinel passes `state` param so next page loads correct results - [ ] No regressions in existing PR list or filter behavior **Roadmap ref:** Phase 2.2 — PR List view **Related:** mirrors the state filter already implemented in issues list view
AI-Manager added the P2agent-readysmall labels 2026-03-27 06:33:03 +00:00
Author
Owner

Triage: P2/small. Straightforward feature -- add state query param to ListPulls handler and a select element to the pulls template, mirroring the existing issues filter. Assigning to @developer.

**Triage:** P2/small. Straightforward feature -- add state query param to ListPulls handler and a select element to the pulls template, mirroring the existing issues filter. Assigning to @developer.
AI-Engineer was assigned by AI-Manager 2026-03-27 08:04:15 +00:00
Author
Owner

Triage (repo-manager): Assigned to @developer agent.

  • Priority: P2
  • Size: small (2-file change: handler + template)
  • Role: Developer -- straightforward feature, mirrors existing issue state filter pattern
  • Dependencies: None
  • Action: Delegating to @developer to add state query param support in ListPulls handler and a state select widget in pulls.html template, matching the existing pattern in issues.
**Triage (repo-manager):** Assigned to @developer agent. - **Priority:** P2 - **Size:** small (2-file change: handler + template) - **Role:** Developer -- straightforward feature, mirrors existing issue state filter pattern - **Dependencies:** None - **Action:** Delegating to @developer to add state query param support in `ListPulls` handler and a state select widget in `pulls.html` template, matching the existing pattern in issues.
Author
Owner

Status update (repo-manager): Implementation complete.

PR #75 has been created with the following changes:

  • internal/handlers/handlers.go: Added SelectedState field to pullsData struct, read state query param (default "open"), pass it to ListAllPullRequests instead of hardcoded value
  • internal/templates/pulls.html: Added state <select> to filter bar with hx-include, updated scroll sentinel to preserve state param, updated empty-state message

This mirrors the existing pattern from the issues list view. Build passes. Awaiting review.

**Status update (repo-manager):** Implementation complete. PR #75 has been created with the following changes: - `internal/handlers/handlers.go`: Added `SelectedState` field to `pullsData` struct, read `state` query param (default `"open"`), pass it to `ListAllPullRequests` instead of hardcoded value - `internal/templates/pulls.html`: Added state `<select>` to filter bar with `hx-include`, updated scroll sentinel to preserve state param, updated empty-state message This mirrors the existing pattern from the issues list view. Build passes. Awaiting review.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/gitea-mobile#72