brief sprint C3.b+c+d+e: share-post Line+Brief async, magic-link / invalid-link banners use Brief styling, .alert-* retired — TDD
Closes the C3 brief sprint. Three event sources (note unlock, share invite, login messages) now route through the Brief slide-down, & the legacy .alert-success/.alert-warning rendering in base.html is retired.
C3.b — share-post async Line + Brief:
- billboard.share_post detects Accept: application/json. JSON path appends a Line (text="Shared with X at <isoformat>", isoformat carries microseconds so two rapid shares of the same email don't collide on Line.unique_together(post,text)), spawns a Brief(kind=SHARE_INVITE) for the sharer, and returns {brief: brief.to_banner_dict() | None, line_text, recipient_display}. Sharer-shares-with-themselves stays a silent no-op (response carries brief: null). Legacy form-submit path preserved for non-AJAX (still redirects + flashes the privacy-safe message — kept for older FTs / no-JS fallback).
- billboard.Brief.to_banner_dict() (moved from dashboard.views helper to a model method) shapes the JSON the banner JS consumes.
- post.html: share form intercepted by JS — fetches POST w. Accept:application/json, then appends `data.line_text` as the next row in #id_post_table, calls Brief.showBanner(data.brief), and (when registered) appends a fresh `<span class="post-recipient">` to the new #id_post_recipients box. No page reload — the alert-success flash is gone.
- 10 new ITs (SharePostAsyncTest + SharePostLegacyRedirectTest) cover the JSON path, line append, brief creation w. SHARE_INVITE kind, registered/unregistered recipient behaviour, sharer-self skip, line dedupe via timestamp, and that the legacy form-submit redirect path still works.
- functional_tests.test_sharing line numbering updated: the share now records its own Line so the alice-reply lands at row 3 instead of 2.
C3.c+d — magic-link confirmation + invalid-link error use Brief banner styling:
- base.html's {% if messages %} block stops rendering .alert-success/.alert-warning divs. Instead each message renders as a transient Brief-styled banner: <div class="note-banner note-banner--message note-banner--{{level_tag}}"> with .note-banner__body / __description carrying the message text and a .btn-cancel NVM that removes the banner via inline onclick. No DB Brief row; no FYI; no square. Same Gaussian-glass look as note-unlock + share-invite Briefs.
- _note.scss adds the note-banner--message variant (full-opacity description) + note-banner--error/--warning border-color override (priRd 0.6) so the invalid-link banner reads as red/abandon.
C3.e — .alert-success/.alert-warning retired in markup; the SCSS class blocks aren't referenced anywhere else in templates so they sit dormant (left in place — base form styling keeps .form-control etc. working; no need to ripple into _base.scss).
Banner JS (note.js / Brief module) was untouched in C3.b+c+d — the Brief.showBanner contract from C3.a already handles all three kinds (NOTE_UNLOCK / USER_POST / SHARE_INVITE) by reading kind off the brief; the message-banner path doesn't go through showBanner because there's no Brief row.
Tests: 218 dashboard+billboard+api ITs + 322 lyric+dashboard+billboard ITs + 2 sharing FTs + 9 my_notes FTs + 1 Jasmine FT all green. Existing lyric.test_views login message-text assertions unchanged (they pull from messages framework — not the rendered HTML — so the markup swap doesn't affect them).
Code architected by Disco DeDisco <discodedisco@outlook.com>
Git commit message Co-Authored-By:
Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -366,30 +366,11 @@ def sky_save(request):
|
||||
if user.sky_chart_data:
|
||||
note, created, brief = Note.grant_if_new(user, "stargazer")
|
||||
if created and brief is not None:
|
||||
brief_payload = _brief_to_banner_dict(brief)
|
||||
brief_payload = brief.to_banner_dict()
|
||||
|
||||
return JsonResponse({"saved": True, "brief": brief_payload})
|
||||
|
||||
|
||||
def _brief_to_banner_dict(brief):
|
||||
"""Shape a Brief for the slide-down banner JS. NOTE_UNLOCK kind carries
|
||||
a `square_url` pointing at /billboard/my-notes/ so the thumbnail-square
|
||||
inside the banner jumps direct to the user's Note collection."""
|
||||
square_url = ""
|
||||
if brief.kind == "note_unlock":
|
||||
from django.urls import reverse
|
||||
square_url = reverse("billboard:my_notes")
|
||||
return {
|
||||
"id": str(brief.id),
|
||||
"kind": brief.kind,
|
||||
"title": brief.title,
|
||||
"line_text": brief.line.text if brief.line else "",
|
||||
"post_url": brief.post.get_absolute_url(),
|
||||
"square_url": square_url,
|
||||
"created_at": brief.created_at.isoformat(),
|
||||
}
|
||||
|
||||
|
||||
@login_required(login_url="/")
|
||||
def sky_delete(request):
|
||||
if request.method != 'POST':
|
||||
|
||||
Reference in New Issue
Block a user