Skip to content

Fix CfP review messages sort links when not filtering - #2394

Open
Anthony-Sin wants to merge 1 commit into
emfcamp:mainfrom
Anthony-Sin:fix/1752-messages-sort-type-all
Open

Anthony-Sin wants to merge 1 commit into
emfcamp:mainfrom
Anthony-Sin:fix/1752-messages-sort-type-all

Conversation

@Anthony-Sin

Copy link
Copy Markdown

Fixes #1752

What this changes

The "all messages" page at /admin/cfp-review/messages renders one table row per proposal with messages, and its column headers are sort links. With no type filter applied the view sets filter_type = "all", so every sort link rendered by messages.html carried type=all. Following any of them applied Proposal.type == "all" to the query, which matches nothing — sorting an unfiltered table emptied it.

Two small changes:

  • apps/cfp_review/base.py: the view now treats type=all the same as a missing type parameter, so a stale or hand-typed type=all URL no longer filters every row out.
  • templates/cfp_review/messages.html: sort and "unread first" links use qs_type, which is none when the page is unfiltered, so the links no longer inject type=all into the query string at all.

Also adds tests/cfp_review/test_messages_sort.py with two regression tests: sorting with type=all still returns all proposals with messages, and the rendered sort links no longer contain type=all.

Evidence

Before (test client, seeded with a talk and a workshop proposal that each have a message):

== GET /admin/cfp-review/messages (no filter) ==
<h2>All messages <small>(showing 2)</small></h2>
sort link: /admin/cfp-review/messages?sort_by=unread&amp;type=all
sort link: /admin/cfp-review/messages?sort_by=date&amp;reverse=True&amp;type=all
...
== GET .../messages?sort_by=date&type=all ==
<h2>All messages <small>(showing 0)</small></h2>
has 'My test talk': False

After the fix, the new tests pass:

tests/cfp_review/test_messages_sort.py ..  [100%]
2 passed

Checks run: ruff format --check and ruff check clean, mypy reports "Success: no issues found in 183 source files". The pytest suite passes for tests/cfp_review and tests/content (13 passed, 14 skipped). In the full suite, tests/volunteer/test_role.py::test_grouped_by_team fails identically on unmodified main, so it is unrelated to this change.

AI disclosure

I work on this as part of a university open-source contribution course and use Claude Code (Anthropic) in my development workflow: it helped me locate the filtering code, draft the regression tests, and format this description. I reproduced the issue, chose the fix, and ran all tests myself; I reviewed the full diff before opening this PR.

When no type filter is applied the messages view passes type='all' to
the template, which then injects type=all into every sort link. Any
sorted view then filters proposals on Proposal.type == 'all' and shows
no rows.

Treat type=all as unfiltered in the view and drop the type parameter
from the template's sort and unread links when it is 'all'.

Adds regression tests covering both directions.

Fixes emfcamp#1752

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CFP review all messages sorting links broken when not filtering

1 participant