~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0

A group's members are run from its page

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/group-host:host/run-members

What changes

A group's members are run from its page (/g/<handle>), each part shown to whoever the group's roles let do it:

  • Roles: each member's roles to give or take, those the person looking may give, by their roles' grants (assignRoles), keeping the roles they may not give.
  • Putting out: someone, for one who may (ejectMember).
  • Invites: someone, by their handle, and the invites waiting, each to take back (createInvite, listInvites, revokeInvite).

Invitations on home. The groups that have invited the person looking, each to join (requestJoin, which takes up the invite) or turn down (declineInvite).

A refusal is the page's to say. The host's refusal of anything done from a group's page or home is shown on it, as /new already did, rather than as an error page (act in data.ts), as the group-page pull's review suggested.

On the host:

  • getGroup names members and those asking by the handle their DID document names (actor_view, from the documents the host keeps a while), and by DID alone when it cannot read one.
  • com.atproto.identity.resolveHandle resolves anyone's handle, as a PDS does, for someone signed in: by the configured HANDLE_RESOLVERS. A handle of the host's own still resolves for anyone. A stranger cannot send the host to a handle's server.

Why

Step 7's next part: running a group's people from the console. Its settings (profile, rules, its apps and app passwords) come next.

How it was checked

  • tests/group_handle.rs: resolving another's handle, refused to a stranger and done for someone signed in.
  • tests/groups.rs and tests/joining.rs: members and those asking carry handles.
  • tests/actors.rs: someone whose document cannot be read is named by DID.
  • just e2e, four new flows (thirteen in all), passing locally:
    • inviting by handle, and an unknown handle refused on the page;
    • Bob taking up the invitation from his home page;
    • saving his roles, and putting him out;
    • the only admin's leaving refused, the page saying why.

svelte-check, the layers and the build pass.

Shortcomings

  • Roles are given from the ones a group has; defining roles (putRole) on the page comes with the group's settings.
Approved

This pull adds member management to a group's page: roles, putting people out, and invites by handle. It adds invitations on home and shows the host's refusals on the page. On the host, getGroup now names members and join requests by handle, and resolveHandle resolves other hosts' handles for signed-in callers. I found nothing that must change.

  • resolveHandle: the outside lookup only happens when the handle isn't local and caller returns someone. The test covers an unauthenticated stranger getting HandleNotFound, a signed-in caller getting a result, and an unknown handle failing.
  • act and the forms: the actions return act(...), so refusals show on the page. The /invite action builds its own fetch calls and doesn't use act. It is correct, but it's the one place with duplicated failure handling.
  • Checks: check passes. test, web and e2e were still queued or running when I looked, so I could not read their results. I did not run the code.
  • Slower getGroup: it now awaits a DID document lookup for each member and each request, one after another. That is fine while the host's cache covers it. If member lists grow large, resolving them concurrently would cap the latency.
Merged as 65a63d7