tooltips: tense-aware expiry (expires/expired) + a <60min 'N min' bucket in the shared relative_ts — TDD
Some checks failed
ci/woodpecker/push/pyswiss Pipeline was successful
ci/woodpecker/push/main Pipeline failed

The token + position-circle expiry tooltips hardcoded 'expires' and never
flipped to 'expired' once the time passed — a seat whose `cost_current_until`
(the 7d cost clock) lapsed still read 'expires 11:30 p.m.' (staging 2026-06-08).

- New `expiry_phrase(dt)` filter (lyric_extras): 'expires <when>' for a FUTURE
  datetime, 'expired <when>' for a PAST one — the verb carries the tense so the
  underlying `relative_ts` stays direction-agnostic. Wired into
  `Token.tooltip_expiry` + the position-circle `data-tt-expiry` (position-tooltip.js
  copies it verbatim, so no JS change).
- `relative_ts` gains a <60min → 'N min' bucket (buckets: 60min / 24h / 7d /
  12mo / >12mo). Per user-spec it stays SHARED, so scroll.html's provenance feed
  (+ post.html / my-games row-ts) now reads 'N min' for very recent events too.

TDD: relative_ts <60min past+future + the 1h boundary; expiry_phrase
none/future/past/wraps-relative_ts; billboard post-line test updated (3h→clock-
time, + new just-posted→'N min'). 727 lyric+billboard+gameboard ITs green.

Bundled (parallel work): rootvars.scss chroma-hue primaries brightened
(--priRd/Or/Gn/Tk/Bl/Id + --terGn).

[[project-position-circle-tooltips]]

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Disco DeDisco
2026-06-08 18:20:09 -04:00
parent a0499723d3
commit a02f3473d5
6 changed files with 90 additions and 24 deletions

View File

@@ -620,9 +620,9 @@ class SaveScrollPositionTest(TestCase):
class PostLineRelativeTimestampTest(TestCase):
"""post.html mirrors scroll.html's bucketed `relative_ts` time rendering:
same-day Lines show a time; older ones collapse to weekday / month-day /
month-day-year. Bypasses `auto_now_add` with a queryset .update() so the
test can backdate Lines."""
<60min Lines show minutes; same-day a time; older ones collapse to weekday
/ month-day / month-day-year. Bypasses `auto_now_add` with a queryset
.update() so the test can backdate Lines."""
def setUp(self):
self.owner = User.objects.create(email="owner@post-ts.io", username="owner")
@@ -638,13 +638,25 @@ class PostLineRelativeTimestampTest(TestCase):
)
def test_recent_line_renders_clock_time(self):
self.Line.objects.create(post=self.post, text="now", author=self.owner)
# 3 h ago — within the day but past the new <60min bucket → clock time.
line = self.Line.objects.create(post=self.post, text="recent", author=self.owner)
self._backdate(line, hours=3)
response = self.client.get(reverse("billboard:view_post", args=[self.post.id]))
self.assertRegex(
response.content.decode(),
r'class="post-line-time"[^>]*>\s*\d+:\d{2}\s*[ap]\.m\.\s*<',
)
def test_under_hour_line_renders_minutes(self):
# New shared <60min bucket: a just-posted Line reads "N min", not a clock
# time (user-spec 2026-06-08 — same formatter the expiry tooltips use).
self.Line.objects.create(post=self.post, text="now", author=self.owner)
response = self.client.get(reverse("billboard:view_post", args=[self.post.id]))
self.assertRegex(
response.content.decode(),
r'class="post-line-time"[^>]*>\s*\d+ min\s*<',
)
def test_two_day_old_line_renders_weekday(self):
line = self.Line.objects.create(post=self.post, text="old", author=self.owner)
self._backdate(line, days=2)