Drop accepted/revoked invites from the pending invites list (#61)

list_site_invites returned every invite ever sent, so the admin UI's
"Pending invites" section kept showing accepted/revoked rows forever
(just relabeled with a status badge) instead of dropping them. Filter
the query to pending only, and have the revoke action remove its row
from local state immediately instead of leaving a relabeled one behind.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-27 19:13:23 -06:00
co-authored by Claude Sonnet 5
parent ed88eb0205
commit d42bf114dd
4 changed files with 70 additions and 44 deletions
@@ -52,8 +52,14 @@ async def create_site_invite(
async def list_site_invites(db: AsyncSession) -> list[SiteInvite]:
# Pending only (#61) -- the admin UI's only consumer of this list labels
# it "Pending invites" and had no way to drop a row once it was accepted
# or revoked, since the backend returned every invite ever sent forever.
# An accepted/revoked invite has nothing further to act on here; its
# history already lives in the audit log ("user.invite"/"invite.revoke").
result = await db.execute(
select(SiteInvite)
.where(SiteInvite.status == InviteStatus.pending)
.options(selectinload(SiteInvite.inviter))
.order_by(SiteInvite.created_at.desc())
)