From a73ac5e630083652d45ea8818f5c18ee14af6b02 Mon Sep 17 00:00:00 2001 From: CleanDev-Fix <219162456+CleanDev-Fix@users.noreply.github.com> Date: Thu, 4 Jun 2026 15:51:29 -0400 Subject: [PATCH] Show pending bounty proposals on detail page --- app/templates/bounty_detail.html | 38 ++++++++++++++++++++++++++++++++ tests/test_bounty_pages.py | 25 +++++++++++++++++++-- 2 files changed, 61 insertions(+), 2 deletions(-) diff --git a/app/templates/bounty_detail.html b/app/templates/bounty_detail.html index bb93cdec..d6e62b2f 100644 --- a/app/templates/bounty_detail.html +++ b/app/templates/bounty_detail.html @@ -59,6 +59,44 @@

{{ bounty.title }}

{% endif %} + {% if bounty.pending_payout_proposals or bounty.pending_close_proposal %} +
+

Pending treasury proposals

+

Capacity already in review

+ {% if bounty.pending_payout_proposals %} + + {% endif %} + {% if bounty.pending_close_proposal %} +

+ Proposal #{{ bounty.pending_close_proposal.proposal_id }} + would close this bounty after {{ bounty.pending_close_proposal.executes_after }}. + {% if bounty.pending_close_proposal.reference %} + {% set close_reference_url = safe_public_url(bounty.pending_close_proposal.reference) %} + {% if close_reference_url %} + Reference: {{ bounty.pending_close_proposal.reference | replace("https://github.com/", "") }}. + {% else %} + Reference: {{ bounty.pending_close_proposal.reference }}. + {% endif %} + {% endif %} +

+ {% endif %} +
+ {% endif %} +

Acceptance

What has to be true

diff --git a/tests/test_bounty_pages.py b/tests/test_bounty_pages.py index 671304c6..0720ba25 100644 --- a/tests/test_bounty_pages.py +++ b/tests/test_bounty_pages.py @@ -162,7 +162,7 @@ def test_bounties_page_shows_effective_capacity_after_pending_payout( acceptance="Public pages should show effective capacity after pending payouts.", ) bounty_id = bounty.id - propose_treasury_action( + proposal = propose_treasury_action( session, action="pay_bounty", payload={ @@ -173,6 +173,7 @@ def test_bounties_page_shows_effective_capacity_after_pending_payout( }, proposed_by="maintainer", ) + proposal_id = proposal.id client = TestClient(create_app(database_url=sqlite_url, webhook_secret="secret")) @@ -189,6 +190,16 @@ def test_bounties_page_shows_effective_capacity_after_pending_payout( assert "Effective remaining" in detail.text assert "Effective available" in detail.text assert "Visible capacity before pending proposals: 2 awards, 50 MRWK." in detail.text + assert "Pending treasury proposals" in detail.text + assert "Capacity already in review" in detail.text + assert f'href="/api/v1/treasury/proposals/{proposal_id}">Proposal #{proposal_id}' in ( + detail.text + ) + assert "would pay github:alice for" in detail.text + assert ( + 'href="https://github.com/ramimbo/mergework/pull/67" rel="nofollow noopener">' + "submitted work" + ) in detail.text assert "1 award still open for distinct accepted work after pending treasury proposals." in ( detail.text ) @@ -211,7 +222,7 @@ def test_bounties_page_shows_effective_capacity_after_pending_close( acceptance="Public pages should show no effective capacity after pending close.", ) bounty_id = bounty.id - propose_treasury_action( + proposal = propose_treasury_action( session, action="close_bounty", payload={ @@ -221,6 +232,7 @@ def test_bounties_page_shows_effective_capacity_after_pending_close( }, proposed_by="maintainer", ) + proposal_id = proposal.id client = TestClient(create_app(database_url=sqlite_url, webhook_secret="secret")) @@ -233,6 +245,15 @@ def test_bounties_page_shows_effective_capacity_after_pending_close( assert "A pending close proposal would make this bounty unavailable if executed." in page.text assert detail.status_code == 200 assert "Visible capacity before pending proposals: 3 awards, 90 MRWK." in detail.text + assert "Pending treasury proposals" in detail.text + assert f'href="/api/v1/treasury/proposals/{proposal_id}">Proposal #{proposal_id}' in ( + detail.text + ) + assert "would close this bounty after" in detail.text + assert ( + 'Reference: ramimbo/mergework/issues/68#close.' + ) in detail.text assert ( "No awards remain after pending treasury proposals; treat new work as unpaid unless " "maintainers reopen or free capacity."