Sharing a list
Roles, invitations by link and by email, joining, leaving.
A synced list can be shared. Only its owner needs the Sync plan; people they invite need an account, nothing more.
Roles
packages/auth/src/list-permissions.ts is the map; the lists_access migration keeps a copy in
private.list_role_permissions, and a test keeps them equal. Apps ask listCan(role, permission),
SQL asks private.has_list_permission(list, permission).
| Permission | owner | admin | editor | viewer |
|---|---|---|---|---|
tasks.write | yes | yes | yes | |
list.update | yes | yes | ||
members.invite | yes | yes | ||
members.remove | yes | yes | ||
members.changeRole | yes | yes | ||
members.manageAdmins | yes | |||
list.delete | yes |
Everyone reads the list, sets their own star, My Day and reminder, and may leave. The owner cannot leave or be removed. At most 25 people are on one list.
Invitations
list_invitations keeps only the hash of each token. The token is an HMAC of the invitation's id
with a server key (private.secrets), so a link copied again is the same link without the token
being stored.
| RPC | Who |
|---|---|
create_list_invitation(for_list, with_role, to_email) | members.invite |
list_invitation_preview(invitation_token) | anyone signed in |
list_invitation_summary(invitation_token) | anyone |
accept_list_invitation(invitation_token) | anyone signed in |
A link works for anyone until it expires (7 days) or is turned off; an email invitation works
once. At most 20 invitations a list a day. The link is <site>/join/<token>: with the app it
opens the join screen, without it the site's invitation page. That page asks
list_invitation_summary, which answers anyone holding the link with who invited, the list's
name and color, the role and the expiry, or that the link has expired; a wrong token or a used email
invitation gets invalid. It never returns tasks or members: the list drawn beside the steps is a
translated example in that color.
The join screen in the app asks list_invitation_preview, which needs a signed-in caller. Besides
who invited, the list's name, description, color, icon and the role, it returns the number of open
tasks, the first three of them (by position), the number of members and the names of the first
three (the owner first). The screen shows them in a card before Join list, so people know what they
are joining. Someone already on the list gets member and the list opens.
Who added a task
On a shared list the task sheet shows who added the task, with their initials, above the date it
was created ("Created by you" for one's own). The server sets a task's owner_id to whoever
inserted it, and the name comes from that person's row in list_members (ownerName in
packages/sync/src/queries/tasks.ts). Once they leave the list the sheet shows only the date.
Notifications
listJoined to the owner and admins, listRemoved to someone another member removed, listEnded
to members when a paused list is deleted. Push only, asked for when someone first shares or joins.