fix: remove every mid-page state-notice alert on the offer page

Fox flagged this three times. Each pass I removed one or two of these
orphan stripes — green Accepted, blue can_act/is_open. Four were
still left in:

  is_declined  → red    "automatically declined — try a higher amount"
  is_withdrawn → yellow "This offer was withdrawn by the buyer."
  is_expired   → yellow "This offer expired before it was accepted."
  is_paid      → green  "Paid — this offer is complete."

The red declined alert was also actively wrong: it asserted "below
the seller's minimum and was automatically declined" even when the
seller manually declined a perfectly reasonable offer. That copy
was hardcoded; the template didn't know whether the auto-decline
threshold fired or a seller hit the button.

Burn all of them. The offer-state-badge in the header well already
shows the state (Accepted / Declined / Withdrawn / Expired / Paid /
Cancelled by buyer) and the action wells below carry every actionable
detail. The orphan stripes were redundant at best and lying at worst.

Functional test test_offer_page_shows_declined_notice → renamed to
test_offer_page_shows_declined_state_in_badge. Asserts:
  - offer-state-badge offer-state-3 + "Declined" text in header
  - "offer-state-notice" string NOT in body
  - "automatically declined" string NOT in body
This commit is contained in:
russell@unturf.com 2026-05-14 17:41:36 -04:00
parent 3c8dbca7c6
commit 7b9d7dc25e
No known key found for this signature in database
2 changed files with 23 additions and 30 deletions

View file

@ -26,31 +26,16 @@
{% endif %}
</div>
{# State-aware notice — explains the current offer state to the viewer
regardless of JS / flash availability. #}
{% if is_declined %}
<div class="alert alert-error offer-state-notice" name="alert">
<p class="alert-message">This offer was below the seller's minimum and was automatically declined &mdash; try a higher amount.</p>
</div>
{% elif is_withdrawn %}
<div class="alert alert-warning offer-state-notice" name="alert">
<p class="alert-message">This offer was withdrawn by the buyer.</p>
</div>
{% elif is_expired %}
<div class="alert alert-warning offer-state-notice" name="alert">
<p class="alert-message">This offer expired before it was accepted.</p>
</div>
{% elif is_paid %}
<div class="alert alert-success offer-state-notice" name="alert">
<p class="alert-message">Paid &mdash; this offer is complete.</p>
</div>
{% endif %}
{# can_act / is_open notices intentionally absent — the "Your turn"
and "Waiting on the other party · they have X to respond" wells
render directly below and carry the same copy. Same pattern as
the dropped accepted-banner — when there's a follow-on action
block carrying the message, the alert stripe just orphans a
band of color in the middle of the page. #}
{# No mid-page state-notice alerts. The offer-state-badge in the
header well at the top of the page is the single source of
truth for the offer's state — Accepted / Declined / Withdrawn
/ Expired / Paid / Cancelled by buyer all surface there. The
orphaned alert stripes (red/blue/green/yellow bands floating
between the header and the action well) used to duplicate that
badge AND, in the declined case, asserted "automatically
declined" copy that was wrong for manually-declined offers.
Everything an offer's viewer needs is in the header badge plus
the action / waiting / pay-now wells below. #}
{% if can_act %}
<section class="offer-actions well">

View file

@ -6165,9 +6165,13 @@ class TestOfferRoutes(_AuthenticatedBase):
)
self.assertEqual(res.status_int, 403)
def test_offer_page_shows_declined_notice(self):
# 10% of list → auto-declined; the detail page must explain why
# without relying on a flash (capability-driven presentation).
def test_offer_page_shows_declined_state_in_badge(self):
# 10% of list → auto-declined. The state is visible via the
# offer-state-badge in the header well — there's no
# mid-page state-notice alert (those orphaned a stripe of
# colour with hardcoded copy that didn't match reality —
# e.g., asserted "automatically declined" even on manually
# declined offers).
product_id = self._make_offer_product(list_price=10000)
self.testapp.get("/log-out")
self.log_in_user(self.user2_creds)
@ -6175,8 +6179,12 @@ class TestOfferRoutes(_AuthenticatedBase):
offer_id = res.json["offer_id"]
page = self.testapp.get(f"/o/{offer_id}", status=200)
body = page.body.decode()
self.assertIn("offer-state-notice", body)
self.assertIn("automatically declined", body)
# State badge says "Declined" (offer-state-3 = DECLINED).
self.assertIn("offer-state-badge offer-state-3", body)
self.assertIn("Declined", body)
# No mid-page notice stripe.
self.assertNotIn("offer-state-notice", body)
self.assertNotIn("automatically declined", body)
def test_offer_page_shows_accepted_notice_with_paynow(self):
product_id = self._make_offer_product(list_price=10000)