chadtmiller.com/group-host
atmosphere group host
People join a group at once, by request, or not without an invite
MergedThis adds joining by joinPolicy: open admits at once, approval queues a request in a new join_request table, and invite is refused. It adds list, admit, deny, cancel and get for requests, and getGroup now shows requests. I found one real bug, and I read only the diff, not the files around it.
admitMember can overwrite an existing member's roles.
- The only gate on
admitMemberis that a pending request exists. A request is not removed when its asker becomes a member by another route. - For example,
assignRolescan add someone who has a pending request.admitMemberthen callsput_membershipfor that person, which replaces their roles with the defaults (or the roles named). - That replacement skips the
keeps_a_configurercheck thatassignRolesruns. A holder ofadmitcould therefore demote the last configurer, or strip any member's roles. - Fix: in
admit_member, returnAlreadyMemberifmembers.membership(did)isSome, and drop the stale request. Add a test for it.
Smaller points, not blocking:
requestJoinstoresmessagewithout a length bound. I did not check whether therequestJoinlexicon setsmaxLengthonmessage, so please confirm it does and that the host enforces it.- If
roles: []is passed toadmitMember, the person is admitted with no roles. Decide whether that should be allowed.
crates/group-host/src/group_join.rsline 149Outdated
These lines can no longer be read.
A pending request doesn't mean they're a non-member: assignRoles may have added them since. Check members.membership(did) here and refuse with AlreadyMember, or put_membership below overwrites their roles without the keeps_a_configurer check.
Changed:
- admitMember refuses AlreadyMember when the asker is a member by now, and drops their stale request, so it never replaces anyone's roles. An open group's requestJoin also drops a request made before the group opened. Tests cover both.
- requestJoin's message is held to the lexicon's maxGraphemes 300 / maxLength 3000, refused past that, with a test.
- admitMember with roles: [] is refused: an admission gives some role.
This pull adds joining by joinPolicy. An open group admits at once, an approval group queues the request in the new join_request table, and an invite group refuses with InviteRequired. It also adds the list, admit, deny, cancel and get methods for requests, and getGroup now shows requests. I read the whole diff but not the files around it, and I did not run the tests.
Round 1 asked for three things, and all three are done:
admitMemberoverwriting a member's roles:admit_membernow returnsAlreadyMemberwhen the person already has a membership, and drops the stale request first. A test covers it.- Message length:
requestJoinnow capsmessageat 300 characters and 3000 bytes, with a test for 301 characters. I did not check these limits against the lexicon'smaxLength. roles: []: it is now rejected withInvalidRequest, with a test.
Not blocking: admitMember can now return AlreadyMember, but admitMember.json does not list it in its errors.
What changes
People join a group at once, by request, or not without an invite. These are new methods in
group_join.rs, by the profile'sjoinPolicy:open:fyi.opensocial.requestJoinadmits at once, with the roles the group marks default (member, unless it marks others).approval:requestJoinkeeps a request, with the asker's message.fyi.opensocial.listJoinRequests(needsadmit) lists those waiting, newest first, a page at a time.fyi.opensocial.admitMember(needsadmit) admits one, with the defaults or the roles named. Each role must be one the admitter may give (NotAssignable): admitting gives roles, so it is bound asassignRolesis.fyi.opensocial.denyJoinRequest(needsadmit) turns one down.fyi.opensocial.cancelJoinRequestwithdraws one's own, andfyi.opensocial.getJoinRequestreturns one's own while it waits.invite: refused withInviteRequired. Invites come next.AlreadyMember, and a switched-off group refuses.getGroupshows a non-member their own waiting request (viewer.request), and showsjoinRequeststo whoever may admit.Requests wait in a new
join_requesttable, not in the group's records: who asks is no member, and the members space is for members. A decided request is removed, so one turned down looks the same as one never made.Membersingroup_members.rsgainsdefault_rolesandput_membership, whichassignRolesnow uses too. The lexicons gain the errors these methods return.docs/design/membership.mdgains "Joining".Why
This is step 5's second part, following the prototype's
requestJoinandmethods/join.ts. One change: the prototype kept decided requests, with who decided. Here a decided request is simply removed, which the prototype's own comment says is the point: a denial should look like never having asked. Invite redemption, which runs throughrequestJoinin the prototype, comes with invites in the next pull.How it was checked
tests/joining.rscovers:memberwhen none is marked;AlreadyMember.InviteRequired, malformed calls, and a switched-off group.getGroupfor the asker, for admins, and for a member;just covis at 100% of lines and functions. Clippy andjust lexare clean.Shortcomings
🤖 Generated with Claude Code