remove dead my-sea invite accept/decline endpoints — acceptance is now implicit on bud-page sea-btn visit (accept-on-GET)

The @mailman Post's OK/BYE block + _invite_actions.html were dropped by the
bud-landing-page sprint; with accept-on-GET on my_sea_visit shipped in f5ee83b
the explicit endpoints have no trigger left. Removes:

- my_sea_invite_accept / my_sea_invite_decline views + the _sea_invite_for_request
  / _redirect_to_invite_log helpers they alone used (gameboard/views.py)
- the my-sea/invite/accept + my-sea/invite/decline URL routes (gameboard/urls.py)
- _invite_actions.html partial (already un-included from post.html)
- MySeaInviteAcceptDeclineTest (gameboard ITs); MySeaInvitePostRenderTest now
  asserts the form actions are gone by literal path/class instead of reverse()

There is no decline surface now — an un-clicked invite simply lapses after 24h.
post.html comment trimmed to match. 515 gameboard+billboard ITs/UTs green.

Code architected by Disco DeDisco <discodedisco@outlook.com>
Git commit message Co-Authored-By:
Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Disco DeDisco
2026-05-29 11:52:38 -04:00
parent f5ee83be0a
commit 3bf35ad539
5 changed files with 22 additions and 169 deletions

View File

@@ -818,62 +818,11 @@ def my_sea_invite(request):
})
def _sea_invite_for_request(request, invite_id):
"""Fetch a SeaInvite + decide whether the requester is its invitee. Matches
on the invitee FK when set, else on email (handles an invite created
before the recipient registered). Returns ``(invite, is_invitee)``."""
from .models import SeaInvite
invite = get_object_or_404(SeaInvite, id=invite_id)
if invite.invitee_id is not None:
is_invitee = invite.invitee_id == request.user.id
else:
is_invitee = (
(invite.invitee_email or "").lower() == (request.user.email or "").lower()
)
return invite, is_invitee
def _redirect_to_invite_log(invite):
"""Redirect to the invitee's "Acceptances & rejections" Post (where the
invite Line lives) so the OK/BYE line re-renders post-transition. Falls
back to /gameboard/ if the invite has no linked line/post yet."""
from django.urls import reverse
if invite.line_id and invite.line.post_id:
return redirect(reverse("billboard:view_post", args=[invite.line.post_id]))
return redirect("gameboard")
@login_required(login_url="/")
@require_POST
def my_sea_invite_accept(request, invite_id):
"""Invitee accepts a PENDING my-sea invite → ACCEPTED. Links the invitee
FK + stamps accepted_at. Phase B will redirect to the owner's spectator
table (`my_sea_visit`); for now we redirect back to the invite log Post so
the line re-renders with its Accepted badge."""
from .models import SeaInvite
invite, is_invitee = _sea_invite_for_request(request, invite_id)
if not is_invitee:
return HttpResponseForbidden()
if invite.status == SeaInvite.PENDING and not invite.is_expired:
invite.status = SeaInvite.ACCEPTED
invite.accepted_at = timezone.now()
invite.invitee = request.user
invite.save(update_fields=["status", "accepted_at", "invitee"])
return _redirect_to_invite_log(invite)
@login_required(login_url="/")
@require_POST
def my_sea_invite_decline(request, invite_id):
"""Invitee declines a PENDING my-sea invite → DECLINED."""
from .models import SeaInvite
invite, is_invitee = _sea_invite_for_request(request, invite_id)
if not is_invitee:
return HttpResponseForbidden()
if invite.status == SeaInvite.PENDING:
invite.status = SeaInvite.DECLINED
invite.save(update_fields=["status"])
return _redirect_to_invite_log(invite)
# Explicit accept/decline endpoints (the @mailman Post's OK/BYE forms +
# `_invite_actions.html`) were removed 2026-05-29: acceptance is now implicit
# — clicking the bud-page sea sub-btn lands on `my_sea_visit`, which accepts a
# still-pending invite on GET. There is no decline surface; an un-clicked
# invite simply lapses after 24h (`SeaInvite.is_expired`).
# ── Phase B — my-sea spectator (invitee) surfaces ───────────────────────────