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/tests/test_notifications_behaviour.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'packages/meshbay-hub/tests/test_notifications_behaviour.py') diff --git a/packages/meshbay-hub/tests/test_notifications_behaviour.py b/packages/meshbay-hub/tests/test_notifications_behaviour.py index 4684d3f..2d0b273 100644 --- a/packages/meshbay-hub/tests/test_notifications_behaviour.py +++ b/packages/meshbay-hub/tests/test_notifications_behaviour.py @@ -11,6 +11,7 @@ import base64 import hashlib import pytest +from membership import add_member from meshbay_hub.db.models import GroupMember, Notification, User from sqlalchemy import select @@ -40,8 +41,7 @@ async def test_chat_keeps_one_notification_per_group(client, db_session): g = await client.post("/v1/groups", json={"name": "busy"}, headers={"Authorization": f"Bearer {owner}"}) gid = g.json()["group_id"] - await client.post(f"/v1/groups/{gid}/members/listener", json={}, - headers={"Authorization": f"Bearer {owner}"}) + await add_member(client, gid, 'listener', {"Authorization": f"Bearer {owner}"}) uid = (await db_session.execute( select(User.id).where(User.username == "listener"))).scalar_one() @@ -72,8 +72,7 @@ async def test_muting_a_group_stops_notifications_being_created(client, db_sessi g = await client.post("/v1/groups", json={"name": "loud"}, headers={"Authorization": f"Bearer {owner}"}) gid = g.json()["group_id"] - await client.post(f"/v1/groups/{gid}/members/quiet_test", json={}, - headers={"Authorization": f"Bearer {owner}"}) + await add_member(client, gid, 'quiet_test', {"Authorization": f"Bearer {owner}"}) r = await client.post(f"/v1/groups/{gid}/mute", json={"muted": True}, headers={"Authorization": f"Bearer {token}"}) @@ -170,8 +169,7 @@ async def test_you_are_not_notified_of_your_own_message(client, db_session): headers={"Authorization": f"Bearer {owner}"}) gid = g.json()["group_id"] for name in ("chatty_test", "quiet_test"): - await client.post(f"/v1/groups/{gid}/members/{name}", json={}, - headers={"Authorization": f"Bearer {owner}"}) + await add_member(client, gid, name, {"Authorization": f"Bearer {owner}"}) ids = {u.username: u.id for u in (await db_session.execute( select(User).where(User.username.in_(["operator", "chatty_test", "quiet_test"])) -- cgit v1.2.3