post.html: gear-btn + #id_post_menu (NVM / DEL / BYE) mirror room.html's #id_room_menu — all Posts get the gear w. NVM (→ billboard:my_posts); user-Posts (kind=USER_POST / SHARE_INVITE) additionally surface DEL for the author (POST → billboard:delete_post → hard-deletes the Post; cascades Lines via FK + clears shared_with M2M) and BYE for invitees (POST → billboard:abandon_post → removes request.user from post.shared_with; owner + other invitees keep the thread); admin-Posts (kind=NOTE_UNLOCK) intentionally render gear w. NVM only since the system thread isn't user-owned (defence-in-depth: both delete_post + abandon_post no-op on NOTE_UNLOCK so a forged POST can't bypass the menu's branch); _post_gear.html partial gates DEL/BYE on viewer_is_owner (set by view_post since the buds sprint) + post.kind, then includes the shared apps/applets/_partials/_gear.html btn; styling rides the existing applets.scss page-level pattern — .post-page joins .billboard-page / .room-page / .dashboard-page / .wallet-page / .gameboard-page / .billscroll-page in the > .gear-btn { position: fixed; bottom: 4.2rem; right: 0.5rem } rule (and the landscape footer-sidebar centred variant), #id_post_menu joins the %applet-menu extension list + the page-level fixed-menu rule (bottom: 6.6rem; right: 1rem); 5 FTs in test_bill_post_gear.py (owner DEL flow, invitee BYE flow, 3 menu-shape assertions for owner/invitee/admin) + 11 ITs across DeletePostViewTest + AbandonPostViewTest (302 redirect target, side effect, GET-is-no-op, non-owner / non-invitee / NOTE_UNLOCK protection) — TDD
Some checks failed
ci/woodpecker/push/pyswiss Pipeline was successful
ci/woodpecker/push/main Pipeline failed

Code architected by Disco DeDisco <discodedisco@outlook.com>
Git commit message Co-Authored-By:
Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Disco DeDisco
2026-05-12 22:26:12 -04:00
parent c64d7b9534
commit 6a7464ee4b
7 changed files with 322 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
{# Gear menu on post.html — mirrors apps/gameboard/_partials/_room_gear.html. #}
{# All Posts get the gear w. NVM (back to my_posts). #}
{# User-Posts add DEL (owner) or BYE (invitee). #}
{# Admin-Posts (kind=NOTE_UNLOCK) intentionally have NVM only — DEL + BYE #}
{# don't apply to system-authored threads. #}
<div id="id_post_menu" style="display:none">
<a href="{% url 'billboard:my_posts' user_id=request.user.id %}" class="btn btn-cancel">NVM</a>
{% if post.kind != 'note_unlock' %}
{% if viewer_is_owner %}
<form method="POST" action="{% url 'billboard:delete_post' post.id %}">
{% csrf_token %}
<button type="submit" class="btn btn-danger" data-confirm="Delete this post?">DEL</button>
</form>
{% else %}
<form method="POST" action="{% url 'billboard:abandon_post' post.id %}">
{% csrf_token %}
<button type="submit" class="btn btn-abandon" data-confirm="Leave this post?">BYE</button>
</form>
{% endif %}
{% endif %}
</div>
{% include "apps/applets/_partials/_gear.html" with menu_id="id_post_menu" %}