Skip to content

Let proposers always find their own questioned proposals#919

Merged
JoaquinBN merged 3 commits into
devfrom
JoaquinBN/proposer-questioned-visibility
Jul 11, 2026
Merged

Let proposers always find their own questioned proposals#919
JoaquinBN merged 3 commits into
devfrom
JoaquinBN/proposer-questioned-visibility

Conversation

@JoaquinBN

@JoaquinBN JoaquinBN commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

A reviewer reported getting "Proposal questioned" notifications but finding zero results when clicking through or searching proposed-by:me proposal-status:questioned. The filters themselves are correct; the problem was two-fold:

  • Visibility scoping could hide a proposer's own proposal. Propose-only stewards only saw state='pending' submissions, so a questioned proposal sitting on a submission awaiting more information, or one whose author had since lost the propose permission for that type, was unreachable by its author even though the portal notifies them and blocks final review until they revise it. Steward visibility now always includes submissions where the steward is the active proposer, regardless of state or current per-type permissions. Once a final decision clears the proposal fields, this extra visibility ends with it.
  • The notification deep link hard-coded status=pending. Questioned proposals can live on pending or more_info_needed submissions, and the notification can be opened after the submission moved on; the hard-coded status filter then guaranteed "No submissions found matching your filters". The questioned-proposal link now opens with the All status filter, so the submission-id search always resolves. Other notifications keep the previous link behavior.

Note for reviewers of this PR: searching has:proposal still intentionally excludes questioned proposals (that filter means "ready for final review"); the working query is proposal-status:questioned, and a regression test documents both behaviors.

Test plan

  • 6 regression tests in contributions/tests/test_questioned_proposal_visibility.py: the exact search-bar query a proposer uses, the bare questioned filter, the has_proposal=true exclusion trap, visibility on more_info_needed submissions, visibility after permission revocation, and the notification deep-link UUID search
  • Full steward permission, steward search, and notifications suites pass (110 tests)

Summary by CodeRabbit

  • New Features
    • Reviewers can now always locate and open their own questioned proposals, including when submissions are awaiting more information or status/permissions would otherwise hide them.
    • “Proposal questioned” notification links now direct to the correct submission regardless of its current status.
  • Bug Fixes
    • Improved steward visibility filtering so proposed-by stewards can still see their own submissions.
    • Tightened search filter parsing so me strictly maps to the current user ID and doesn’t fall back to name/steward matching when unavailable.
  • Documentation
    • Added an Unreleased changelog entry describing the updated proposal visibility and notification behavior.

Stewards are notified when their proposal is questioned and final
review stays blocked until they revise it, but the steward queue's
visibility scoping could hide the very submission they must act on:
propose-only stewards only saw pending submissions, so a questioned
proposal sitting on a submission awaiting more information, or one
whose author lost the propose permission for that type, was
unreachable while the notification kept pointing at it. Steward
visibility now always includes submissions where the steward is the
active proposer, regardless of state or current per-type permissions.

The questioned-proposal notification also linked to the queue with a
hard-coded pending status filter, which showed zero results whenever
the submission was not in the pending state; that link now opens with
the All status filter so the submission id search always resolves.

## Implementation Notes
- backend/contributions/views.py: _visible_submission_queryset ORs a
  proposed_by=request.user clause into the steward visibility filter
- backend/notifications/services.py: steward_submission_review_link
  takes a status parameter (default unchanged); the proposal-questioned
  notification passes status='' (All)
- backend/contributions/tests/test_questioned_proposal_visibility.py:
  regression tests for the search-bar query a proposer uses, the
  has_proposal=true trap (excludes questioned by design), visibility on
  more_info_needed submissions, visibility after permission revocation,
  and the notification deep-link query
@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Questioned proposals remain visible to their proposers regardless of computed permissions or submission state. Questioned-proposal notifications link to the all-status view, frontend me filters avoid name matching, and backend/frontend tests cover these behaviors.

Changes

Questioned proposal access

Layer / File(s) Summary
Proposer-owned submission visibility
backend/contributions/views.py, backend/contributions/tests/test_questioned_proposal_visibility.py
The submission queryset includes proposals owned by the current proposer, including questioned proposals outside pending state and after propose permission removal.
Questioned notification deep links
backend/notifications/services.py, backend/contributions/tests/test_questioned_proposal_visibility.py, CHANGELOG.md
Review links accept an explicit status, questioned notifications use the all-status filter, and non-pending search links are tested and documented.
Strict me filter parsing
frontend/src/lib/searchToParams.js, frontend/src/tests/searchParser.test.js
me resolves only to the current user ID or null for assigned, reviewed-by, and proposed-by filters, preventing steward-name fallback.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly captures the main change: proposers can now reliably find their own questioned proposals.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch JoaquinBN/proposer-questioned-visibility

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

When the user profile had not loaded yet, the steward search bar's
'me' shortcut in assigned, reviewed, and proposed-by filters fell
through to substring name matching, so 'me' silently resolved to any
steward whose name contains those letters (e.g. James Medina) and the
results belonged to someone else. 'me' now resolves to the current
user or to nothing at all.

## Implementation Notes
- frontend/src/lib/searchToParams.js: the three 'me' branches
  (assigned, reviewed, proposed-by) return currentUserId or null
  instead of falling through to the stewardsList name lookup
- frontend/src/tests/searchParser.test.js: covers 'me' resolution for
  all three filters plus the profile-not-loaded case against a steward
  list containing a name with the substring 'me'

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@frontend/src/lib/searchToParams.js`:
- Around line 174-175: Add matching explanatory comments to the `reviewed` and
`proposed-by` `val === 'me'` branches, consistent with the existing `assigned`
branch, clarifying that `me` must resolve to `currentUserId` rather than fall
through to name matching.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 6139bef1-e889-4afa-a86d-d97c09299ee2

📥 Commits

Reviewing files that changed from the base of the PR and between a05f367 and 091fe9f.

📒 Files selected for processing (2)
  • frontend/src/lib/searchToParams.js
  • frontend/src/tests/searchParser.test.js

Comment on lines +174 to +175
if (val === 'me') {
reviewedValue = currentUserId || null;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Add the explanatory comment to reviewed and proposed-by me branches for consistency.

The assigned filter includes a helpful comment explaining why me must not fall through to name matching. The reviewed and proposed-by branches use the same pattern but lack the comment, making the intent less clear to future readers.

📝 Suggested comments
     if (val === 'me') {
+      // Never fall through to name matching: "me" must resolve to the
+      // current user or to nothing (profile not loaded yet).
       reviewedValue = currentUserId || null;
     } else if (val === 'me') {
+      // Never fall through to name matching: "me" must resolve to the
+      // current user or to nothing (profile not loaded yet).
       proposedByValue = currentUserId || null;

Also applies to: 204-205

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/src/lib/searchToParams.js` around lines 174 - 175, Add matching
explanatory comments to the `reviewed` and `proposed-by` `val === 'me'`
branches, consistent with the existing `assigned` branch, clarifying that `me`
must resolve to `currentUserId` rather than fall through to name matching.

@JoaquinBN JoaquinBN merged commit 7ce5859 into dev Jul 11, 2026
3 checks passed
@JoaquinBN JoaquinBN deleted the JoaquinBN/proposer-questioned-visibility branch July 11, 2026 11:32
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.

1 participant