From d3ad243c4ae3a273f623bd5fc631e3266aa4d0e4 Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Wed, 30 Sep 2026 11:49:56 +0200 Subject: fix: only the owner decides who hosts a group, and nobody is made a member unasked MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - hub: a node may host a group only if its account owns it or the owner approved that node (new `group_hosts`). Membership was the ceiling, and every member holds the group key, so any member's node could register as a host and be the one clients kept. A node claiming a group it may not host is recorded as a request; the owner is notified once and approves or refuses it (GET/POST/DELETE /v1/groups/{id}/hosts[/{node_id}]), which takes effect on a connected node at once. - hub: an owner adding a username creates an invitation (new `group_invitations`), accepted or declined by the invitee (/v1/groups/invitations, /{id}/invitation/accept|decline). Until then the group is not listed, not dialled, not searched and not in any token. Invitation links, open joins and group creation still make members directly: they are the account's own act. - hub: the MNP token names only the group it is minted for (group_id is now required), so a node operator no longer learns a member's other groups. - SPA: invitations on the home page; invited people and host requests in the group's settings; the transport sends group_id. Ten catalogues. - Browser probes for both screens, run in Chrome and Firefox. - Design §5.2, §7.2, §7.3, AV32, AV33; protocol §6.3; user guide. Co-Authored-By: Claude Opus 5.5 --- packages/meshbay-hub/src/meshbay_hub/api/invite_links.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'packages/meshbay-hub/src/meshbay_hub/api/invite_links.py') diff --git a/packages/meshbay-hub/src/meshbay_hub/api/invite_links.py b/packages/meshbay-hub/src/meshbay_hub/api/invite_links.py index 3c50e19..86fbbb4 100644 --- a/packages/meshbay-hub/src/meshbay_hub/api/invite_links.py +++ b/packages/meshbay-hub/src/meshbay_hub/api/invite_links.py @@ -30,7 +30,7 @@ from meshbay_hub import mail from meshbay_hub.api.deps import _decode_token, get_current_user, require_user_scope from meshbay_hub.api.middleware import limiter from meshbay_hub.db.engine import get_db -from meshbay_hub.db.models import Group, GroupInviteLink, GroupMember, User +from meshbay_hub.db.models import Group, GroupInvitation, GroupInviteLink, GroupMember, User router = APIRouter(prefix="/v1/groups", tags=["invite-links"]) redeem_router = APIRouter(prefix="/v1/invite-links", tags=["invite-links"]) @@ -322,6 +322,11 @@ async def redeem_invite_link( raise HTTPException(status_code=404, detail="invite_not_valid") if not await db.get(GroupMember, (group.id, current_user.id)): db.add(GroupMember(group_id=group.id, user_id=current_user.id)) + # Redeeming a link is the invitee's own act, so it answers an + # invitation to the same group as well. + pending = await db.get(GroupInvitation, (group.id, current_user.id)) + if pending is not None: + await db.delete(pending) from meshbay_hub.api.notifications import create_notification await create_notification( db, row.created_by, "invite_link_redeemed", -- cgit v1.2.3