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

The console's pages do the same act the same way, and settings are pages

Merged chadtmiller.com asked to merge into main from chadtmiller.com/group-host:console/tidy
.claude/skills/ui/SKILL.md+72−34
@@ -30,7 +30,7 @@ just look /g/lanterns.groups.test --as alice --seed full # a group with everyt
just look /g/riders.groups.test --as bob # a group bob is not in
just look /g/lanterns.groups.test --as alice --click 'button[popovertarget=invite]' # a dialog open
just look /g/lanterns.groups.test/settings --as alice --element .group-card --all # one element, in all four
just look / --phone --dark --click 'header [popovertarget=sign-in]' # a dialog, on a phone
just look / --as alice --phone --dark --click '.user-menu summary' # a menu, on a phone
just look /new --as alice --type '[name=displayName]=A name long enough to wrap twice over on a phone' # typed into, then shot
just look /g/lanterns.groups.test --as alice --out target/look/before --name group # pictures to keep apart
```
@@ -77,12 +77,28 @@ harness/layers.mjs` holds each to its layer:
- `atoms`: one element (`Avatar`, `Tag`, `Copy`).
- `molecules`: a few atoms that mean something together (`Section`,
`Empty`, `Dialog`, `MemberRow`, `GroupRow`).
`Empty`, `Dialog`, `FormDialog`, `ConfirmDialog`, `Tabs`, `UserMenu`,
`MemberRow`, `GroupRow`, `HandleInput`).
- `organisms`: a part of a page (`MemberList`, `GroupCard`,
`SiteHeader`).
`SiteHeader`, `RulesEditor`).
- `templates`: a page's layout, without its data (`Page`, `GroupPage`,
`Welcome`).
The pieces every page is made of:
- **A page** is `Page`: where it is under (`back`, a group's page), its
heading, the one act on the whole page across from it (`actions`),
and its parts' `Tabs` (`nav`) when it has more than one.
- **A page with many parts** is a page per part under it, reached by
`Tabs`, as a group's settings are (`/g/<handle>/settings`, `/rules`,
`/roles`, `/apps`, `/recovery`, laid out by its `+layout.svelte`), and
the moderation queue's statuses: not one long page.
- **A part** is `Section`: a card, its title and count, one quiet act on
the whole of it (`actions`), a line on what it is (`intro`), then its
rows or its `Empty`.
- **What is yours** is under your handle in the header, `UserMenu`:
your groups, starting one, moving an account here, then signing out.
Look in `web/src/lib` before making one; a component made for one page
is made at the layer it belongs to, for the next page too.
@@ -114,11 +130,14 @@ opensocial, handles, roles such as `admin`. No `text-transform`.
**Empty states.** One component, `Empty.svelte`, for every empty list or
part, drawn where the list's rows would be: inside the part's card, in
the same box, never as loose text under its heading. Its title says what
is empty in the reader's terms ("Nobody is asking to join", not "No
data"); its line says why, or what will fill it; and where there is a
way out (invite someone, start a group), it carries it as its action.
The same title, body, spacing and box on every page.
the same dashed box, never as loose text under its heading. Its title
says what is empty in the reader's terms ("Nobody is asking to join",
not "No data"); its line says why, or what will fill it; and where
there is a way out that the part's heading does not already carry, it
carries it as its `action`. The same title, body, spacing and box on
every page, a page with nothing for the reader (a settings page for a
plain member, an error) included. Never style an empty state of your
own.
**Space.** Every block stacked on another has a gap from the space
scale; text never touches a row of controls. Things that belong together
@@ -126,39 +145,58 @@ sit closer than things that do not: a heading to its list, less than the
list to the next part.
**Weight.** One primary button on a view at most, for the act the view
is for. What undoes, removes or turns down is `class="quiet"` (Leave,
Take back, Turn down, Cancel, Sign out), and a quiet button never
outweighs what it sits beside: leaving a group is there, never the
loudest thing on the card. Quiet what is said about a thing (`.mute`,
`.small`) next to the thing itself.
is for (Start a group, Join, Save the profile, a dialog's act). What
undoes, removes or turns down is `class="quiet"` (Leave, Take back,
Turn down, Cancel, Sign out), and a quiet button never outweighs what it
sits beside: leaving a group is a small quiet button at the end of the
member's standing, never the loudest thing on the card. A list whose
rows each wait on an act (letting someone in, taking up an invite) may
carry it on each row, `small`, the one thing in the row that is not
quiet. What cannot be undone is `class="danger"`, and only as the act of
a `ConfirmDialog`. A link that goes where a button would act (Start a
group, Settings) is `a.button`, quiet or not by the same rule. Quiet
what is said about a thing (`.mute`, `.what`, `.small`) next to the
thing itself.
**The same act, the same way.** A thing done on two pages is done the
same way on both: the same component, the same words, the same order of
controls.
- *Asking for input.* An act that takes a form (inviting, adding a
rule, a role, a link, a recovery key, an app password) is a button that
opens a dialog (`Dialog.svelte`) holding the form, as "Invite someone"
does: never a form inline on one page and a dialog on another. Editing
what is already there (a profile, its pictures) may be a form in place.
rule, a link, a role, a recovery key, an app password, labelling,
giving roles, a picture, resolving) is a button that opens a
`FormDialog` holding the form, as "Invite someone" does: its title the
act, a line on what it does, the fields, then a quiet Cancel and the
act. Never a form inline on one page and a dialog on another. Only
editing what is already there field by field (a group's profile, who
sees it) is a form in place, and finding (a search box) is never a
dialog. A handle is typed into `HandleInput`, wherever it is asked for.
- *Confirming.* An act that cannot be undone (leaving, putting someone
out, deleting, ending) asks in the same kind of dialog: what will
happen, in a sentence; a quiet Cancel; the act, as the dialog's one
button that acts.
- *Lists.* Rows in the part's card, each with its avatar or mark, its
name, what is said about it, and its acts at the row's end, quiet ones
before the one that acts; the empty state in the rows' place; "Show
more" under the last row when there are more.
- *A part's heading.* `Section.svelte`: its title, with how many when
that is worth saying, and the one act on the whole part (Invite
someone, Add a rule) across from it, as a quiet button; never a link
or a button lower down the card doing the same.
- *Where to go.* Ways to a group's other pages sit together, as the
group's nav, never floating where a banner meets a card.
**Pictures.** A group or person with no picture is drawn as one with
none is meant to look (its initial on its colour), never a blank disc;
a group with no banner shows no banner block.
out, taking a rule, role or key away, revoking, ending an app's
access, disconnecting) opens a `ConfirmDialog`: its title the question
("Leave Riders?"), what will happen in a sentence, a quiet Cancel, and
the act in `danger`. What is undone by doing it again (taking back an
invite, taking a picture away) needs no asking.
- *Lists.* `ul` or `ol` with a class, a row per thing, inside the part's
card: its `Avatar`, `ordinal` or picture first; its name, and under it
what is said about it (`.row-main` with `.what`); its acts at the
row's end in `.row-actions`, `small`, quiet ones before the one that
acts. A person is `MemberRow`, a group `GroupRow`. Times by
`#lib/dates.ts`, never as a record holds them. The empty state in the
rows' place; a quiet "Show more" under the last row while there are
more, a page at a time, never every row at once.
- *A part's heading.* `Section`: its title, with its count when that is
worth saying, and the one act on the whole part (Invite someone, Add a
rule, Make an app password) across from it, as a quiet button; never
a link or a button lower down the card doing the same.
- *Where to go.* A group's own pages (Moderation, Settings) sit together
beside its name, as quiet small `a.button`s; a page under a group says
so with `Page`'s `back`, its name, above its heading.
**Pictures.** `Avatar` is given the name of whom it draws: with no
picture, it draws their initial on a hue their name gives them, never a
blank disc. A group with no banner shows no banner block: its picture,
name and nav sit at the top of its card.
**People.** A person is their avatar and handle, by `MemberRow` or the
header's menu, never a bare DID where a handle is known.
crates/group-host/src/group_invites.rs+12−1
@@ -392,7 +392,18 @@ pub async fn list_invites(
.last()
.filter(|_| waiting.len() == limit as usize)
.map(|i| i.seq.to_string());
let invites: Vec<Value> = waiting.iter().map(view).collect();
// Each with whom it invites, by their handle where it can be read.
let actors = waiting.iter().map(|i| host.actor_view(&i.invitee));
let actors = futures::future::join_all(actors).await;
let invites: Vec<Value> = waiting
.iter()
.zip(actors)
.map(|(i, actor)| {
let mut view = view(i);
view["actor"] = actor;
view
})
.collect();
Ok(Json(json!({"invites": invites, "cursor": cursor})))
}
crates/group-host/tests/invites.rs+7−2
@@ -108,9 +108,14 @@ async fn an_invite_is_written_in_the_invitees_inbox() {
assert_eq!(
(
page["invites"][0]["invitee"].clone(),
page["invites"][0]["expiresAt"].clone()
page["invites"][0]["expiresAt"].clone(),
page["invites"][0]["actor"]["did"].clone()
),
(json!(carol.did), json!("2099-01-01T00:00:00.500Z"))
(
json!(carol.did),
json!("2099-01-01T00:00:00.500Z"),
json!(carol.did)
)
);
let cursor = page["cursor"].as_str().unwrap();
let (_, rest) = ask(
docs/design/recovery.md+3−3
@@ -50,9 +50,9 @@ asked about. The same holds once the DID has been ended.
Adding, listing and removing keys all need `group.configure`, the action
that lets a member change the group's settings (see
[membership](membership.md)). The console's settings page for the group
lists the keys, to whoever configures it, with forms to add and take off
one. These methods are not among the MCP tools (see
[membership](membership.md)). The console's settings for the group
list the keys on a page of their own, to whoever configures it, with a
dialog to add one and another to be sure before taking one off. These methods are not among the MCP tools (see
[MCP](mcp.md)).
The PLC directory says which keys a group has, so each method reads the
docs/reference/api.md+1−1
@@ -71,7 +71,7 @@ spaces through the atproto methods below.
| `POST fyi.opensocial.cancelJoinRequest` | withdraws it |
| `GET fyi.opensocial.listJoinRequests` | the requests waiting, for those who admit |
| `POST fyi.opensocial.denyJoinRequest` | turns a request down |
| `GET fyi.opensocial.listInvites` | the group's invites still waiting |
| `GET fyi.opensocial.listInvites` | the group's invites still waiting, each with whom it invites by their handle |
| `GET fyi.opensocial.getActorInvites` | the caller's own invites from groups here |
| `POST fyi.opensocial.declineInvite` | turns an invite down |
| `GET com.atproto.managedspace.checkUserAccess` | whether someone may read or write an inbox the host keeps, asked by its authority |
harness/e2e/flows.spec.mjs+86−41
@@ -88,7 +88,7 @@ test("signing in at her own PDS, from a group's page", async () => {
await expect(page).toHaveURL(url('/g/riders.groups.test'))
await expect.poll(() => signedInAs(page)).toBe('@alice.test')
await expect(page.getByText('Sign in to see this group.')).toHaveCount(0)
await expect(page.getByText("You're a member, as")).toBeVisible()
await expect(page.getByText(/You're a member/)).toBeVisible()
await page.goto(url('/'))
})
@@ -116,7 +116,7 @@ test('starting a group', async () => {
await page.waitForURL(url('/g/hikers.groups.test'))
await expect(page.getByRole('heading', { name: 'Hikers' })).toBeVisible()
await expect(page.getByText('Walks on Sundays.')).toBeVisible()
await expect(page.getByText("You're a member, as")).toBeVisible()
await expect(page.getByText(/You're a member/)).toBeVisible()
// An address taken already is said as it is typed, with the next free
// one to take; and the host's to refuse, sent all the same.
await page.goto(url('/new'))
@@ -157,11 +157,17 @@ test('asking to join with a note, and being let in', async () => {
await expect(page.locator('.members', { hasText: 'bob.test' })).toBeVisible()
await expect(page.getByText('Nobody is asking to join')).toBeVisible()
await bob.goto(url('/g/hikers.groups.test'))
await expect(bob.getByText("You're a member, as")).toBeVisible()
await expect(bob.getByText(/You're a member/)).toBeVisible()
})
test('leaving a group', async () => {
// Asked to be sure of; cancelled, he is still in.
const sure = bob.getByRole('dialog', { name: 'Leave Hikers?' })
await bob.getByRole('button', { name: 'Leave the group' }).click()
await sure.getByRole('button', { name: 'Cancel' }).click()
await expect(sure).toBeHidden()
await bob.getByRole('button', { name: 'Leave the group' }).click()
await sure.getByRole('button', { name: 'Leave the group' }).click()
await expect(bob.getByRole('heading', { name: 'Ask to join' })).toBeVisible()
})
@@ -190,11 +196,11 @@ test('inviting someone from the dialog', async () => {
await expect(dialog.getByRole('listbox')).toBeHidden()
await dialog.getByRole('textbox', { name: 'A note, if you like' }).fill('Come walk with us.')
await dialog.getByRole('button', { name: 'Send invite' }).click()
await expect(page.locator('.invites', { hasText: who.bob.did })).toBeVisible()
await expect(page.locator('.invites', { hasText: 'bob.test' })).toBeVisible()
}
await send()
await page.getByRole('button', { name: 'Take back' }).click()
await expect(page.locator('.invites', { hasText: who.bob.did })).toHaveCount(0)
await expect(page.locator('.invites', { hasText: 'bob.test' })).toHaveCount(0)
await send()
})
@@ -209,7 +215,7 @@ test('taking up an invitation', async () => {
await bob.getByRole('button', { name: 'Join', exact: true }).click()
await expect(bob.getByRole('heading', { name: "You're in" })).toBeVisible()
await expect(bob.getByText('Welcome to Hikers.')).toBeVisible()
await expect(bob.getByText("You're a member, as")).toBeVisible()
await expect(bob.getByText(/You're a member/)).toBeVisible()
await bob.goto(url('/'))
await expect(bob.getByRole('heading', { name: 'You are invited' })).toHaveCount(0)
await expect(bob.locator('.group-row', { hasText: 'Hikers' }).first()).toBeVisible()
@@ -219,20 +225,24 @@ test('taking up an invitation', async () => {
test('giving roles, and putting someone out', async () => {
const row = () => page.locator('.member', { hasText: 'bob.test' })
await row().getByText('Change').click()
await expect(row().getByRole('checkbox', { name: 'member' })).toBeChecked()
await row().getByRole('button', { name: "Save bob.test's roles" }).click()
// His roles in a dialog, those she may give to tick.
await row().getByRole('button', { name: "Change bob.test's roles" }).click()
const roles = page.getByRole('dialog', { name: "bob.test's roles" })
await expect(roles.getByRole('checkbox', { name: 'member' })).toBeChecked()
await roles.getByRole('button', { name: 'Save their roles' }).click()
await expect(row()).toContainText('member')
await row().getByText('Change').click()
// Put out, once she is sure.
await row().getByRole('button', { name: 'Put bob.test out' }).click()
await page.getByRole('dialog', { name: 'Put bob.test out?' }).getByRole('button', { name: 'Put them out' }).click()
await expect(page.locator('.members', { hasText: 'bob.test' })).toHaveCount(0)
})
test('being told why the host refused', async () => {
// The group's only admin may not leave it: the page says so.
await page.getByRole('button', { name: 'Leave the group' }).click()
await expect(page.locator('.danger')).toBeVisible()
await expect(page.getByText("You're a member, as")).toBeVisible()
await page.getByRole('dialog', { name: 'Leave Hikers?' }).getByRole('button', { name: 'Leave the group' }).click()
await expect(page.locator('p.danger')).toBeVisible()
await expect(page.getByText(/You're a member/)).toBeVisible()
})
test("joining a group anyone can join", async () => {
@@ -249,7 +259,7 @@ test("joining a group anyone can join", async () => {
await expect(bob.locator('.join')).toContainText('Anyone can join.')
await bob.getByRole('button', { name: 'Join', exact: true }).click()
await expect(bob.getByRole('heading', { name: "You're in" })).toBeVisible()
await expect(bob.getByText("You're a member, as")).toBeVisible()
await expect(bob.getByText(/You're a member/)).toBeVisible()
})
test('finding a member, and showing more', async () => {
@@ -281,7 +291,7 @@ test('connecting an AI app is shown to those who run the group', async () => {
await expect(connect.locator('.asks li')).toHaveCount(3)
// Not to a plain member.
await bob.goto(url('/g/hikers.groups.test'))
await expect(bob.getByText("You're a member, as")).toBeVisible()
await expect(bob.getByText(/You're a member/)).toBeVisible()
await expect(bob.getByRole('heading', { name: 'Connect an AI app' })).toHaveCount(0)
})
@@ -289,10 +299,23 @@ test("changing a group's profile", async () => {
await page.goto(url('/g/hikers.groups.test'))
await page.getByRole('link', { name: 'Settings' }).click()
await page.getByRole('textbox', { name: 'Name', exact: true }).fill('Hikers of the Hills')
await page.getByRole('textbox', { name: 'Link 1', exact: true }).fill('https://chat.hikers.example')
await page.getByRole('textbox', { name: 'What link 1 is' }).fill('Our chat')
await page.getByRole('textbox', { name: 'Link 2', exact: true }).fill('https://walks.example/')
const saved = page.waitForResponse((r) => r.request().method() === 'POST' && r.url().includes('/profile'))
await page.getByRole('button', { name: 'Save the profile' }).click()
await saved
// Its links, each added from a dialog: with what it is, or without.
const add = async (address, title) => {
await page.getByRole('button', { name: 'Add a link' }).click()
const dialog = page.getByRole('dialog', { name: 'Add a link' })
await dialog.getByRole('textbox', { name: 'Its address' }).fill(address)
if (title) await dialog.getByRole('textbox', { name: 'What it is, if you like' }).fill(title)
await dialog.getByRole('button', { name: 'Add the link' }).click()
await expect(page.locator('.link-list', { hasText: address })).toBeVisible()
}
await add('https://chat.hikers.example', 'Our chat')
await add('https://walks.example/')
await add('https://gone.example/')
await page.getByRole('button', { name: 'Take away gone.example' }).click()
await expect(page.locator('.link-list', { hasText: 'gone.example' })).toHaveCount(0)
await page.goto(url('/g/hikers.groups.test'))
await expect(page.getByRole('heading', { name: 'Hikers of the Hills' })).toBeVisible()
await expect(page.getByText('Walks on Sundays.')).toBeVisible()
@@ -307,8 +330,9 @@ const PIXEL = Buffer.from('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQ
test("giving a group a picture, and taking it away", async () => {
await page.goto(url('/g/hikers.groups.test/settings'))
await page.getByLabel('Avatar').setInputFiles({ name: 'face.png', mimeType: 'image/png', buffer: PIXEL })
await page.getByRole('button', { name: 'Upload the avatar' }).click()
await page.getByRole('button', { name: 'Add the avatar' }).click()
await page.getByLabel('Avatar', { exact: true }).setInputFiles({ name: 'face.png', mimeType: 'image/png', buffer: PIXEL })
await page.getByRole('dialog', { name: 'Add the avatar' }).getByRole('button', { name: 'Add the avatar' }).click()
// Drawn on its page, from the host, as the image it is: one pixel wide.
await page.goto(url('/g/hikers.groups.test'))
const avatar = page.locator('.identity img.av')
@@ -350,34 +374,43 @@ test("hiding a group's profile, and showing it again", async () => {
})
test('adding a rule, and taking it away', async () => {
// Settings has a page for each part, reached by its tabs.
await page.goto(url('/g/hikers.groups.test/settings'))
await page.getByRole('navigation', { name: 'Settings' }).getByRole('link', { name: 'Rules' }).click()
await expect(page).toHaveURL(url('/g/hikers.groups.test/settings/rules'))
await expect(page.getByText('No rules yet')).toBeVisible()
await page.getByRole('button', { name: 'Add a rule' }).click()
await page.getByRole('textbox', { name: 'Rule' }).fill('Leave no trace')
await page.getByRole('button', { name: 'Add the rule' }).click()
await expect(page.locator('.rules', { hasText: 'Leave no trace' })).toBeVisible()
await expect(page.locator('.rule-rows', { hasText: 'Leave no trace' })).toBeVisible()
// On the group's page, folded under how many there are.
await page.goto(url('/g/hikers.groups.test'))
await page.getByText('Rules (1)').click()
await expect(page.getByText('Leave no trace')).toBeVisible()
await page.goto(url('/g/hikers.groups.test/settings'))
await page.goto(url('/g/hikers.groups.test/settings/rules'))
await page.getByRole('button', { name: 'Take away “Leave no trace”' }).click()
await expect(page.locator('.rules')).toHaveCount(0)
await page.getByRole('dialog', { name: 'Take this rule away?' }).getByRole('button', { name: 'Take it away' }).click()
await expect(page.locator('.rule-rows')).toHaveCount(0)
})
test('defining a role', async () => {
await page.goto(url('/g/hikers.groups.test/settings'))
await page.goto(url('/g/hikers.groups.test/settings/roles'))
await page.getByRole('button', { name: 'Define a role' }).click()
await page.getByRole('textbox', { name: 'Its key' }).fill('leader')
await page.getByRole('textbox', { name: 'Its name' }).fill('Ride leader')
await page.getByRole('checkbox', { name: 'invite' }).check()
await page.getByRole('button', { name: 'Define the role' }).click()
await expect(page.locator('.roles li', { hasText: 'Ride leader' })).toContainText('invite')
await page.getByRole('button', { name: 'Take away Ride leader' }).click()
await page.getByRole('dialog', { name: 'Take away Ride leader?' }).getByRole('button', { name: 'Take it away' }).click()
await expect(page.locator('.roles li', { hasText: 'Ride leader' })).toHaveCount(0)
})
test('making an app password, and ending what it signed in', async () => {
await page.goto(url('/g/hikers.groups.test/settings'))
await page.getByRole('textbox', { name: 'Where it is used' }).fill('Phone')
await page.goto(url('/g/hikers.groups.test/settings/apps'))
await page.getByRole('button', { name: 'Make an app password' }).click()
await page.getByRole('textbox', { name: 'Where it is used' }).fill('Phone')
await page.getByRole('button', { name: 'Make it' }).click()
const password = (await page.locator('code.password').textContent()).trim()
const signIn = () =>
fetch(`${world.host}/xrpc/com.atproto.server.createSession`, {
@@ -386,27 +419,33 @@ test('making an app password, and ending what it signed in', async () => {
body: JSON.stringify({ identifier: 'hikers.groups.test', password }),
})
expect((await signIn()).status).toBe(200)
await page.goto(url('/g/hikers.groups.test/settings'))
await page.goto(url('/g/hikers.groups.test/settings/apps'))
await expect(page.locator('.passwords', { hasText: 'Phone' })).toBeVisible()
// Its sessions a page at a time: shown all, to find it.
while (await page.getByRole('button', { name: 'Show more' }).count()) await page.getByRole('button', { name: 'Show more' }).click()
await page.getByRole('button', { name: "End app-password:Phone's access" }).click()
await page.getByRole('dialog', { name: "End this app's access?" }).filter({ visible: true }).getByRole('button', { name: 'End its access' }).click()
// The console's own token, from inviting, stays.
await expect(page.locator('.sessions', { hasText: 'app-password:Phone' })).toHaveCount(0)
await page.getByRole('button', { name: 'Revoke “Phone”' }).click()
await page.getByRole('dialog', { name: 'Revoke “Phone”?' }).getByRole('button', { name: 'Revoke it' }).click()
await expect(page.locator('.passwords')).toHaveCount(0)
expect((await signIn()).status).toBe(401)
})
test('adding a recovery key, and taking it off', async () => {
const key = didKey()
await page.goto(url('/g/hikers.groups.test/settings'))
await page.goto(url('/g/hikers.groups.test/settings/recovery'))
await expect(page.locator('.recovery-keys li')).toHaveCount(1)
await page.getByRole('button', { name: 'Add a recovery key' }).click()
await page.getByRole('textbox', { name: 'A key of yours, as a did:key' }).fill(key)
await page.getByRole('button', { name: 'Add the recovery key' }).click()
await page.getByRole('button', { name: 'Add the key' }).click()
const keys = page.locator('.recovery-keys li')
await expect(keys).toHaveCount(2)
await expect(keys.first()).toContainText(key)
await expect(keys.last()).toContainText('this host')
await expect(keys.last()).toContainText('This host')
await keys.first().getByRole('button', { name: 'Take off' }).click()
await page.getByRole('dialog', { name: 'Take this key off?' }).getByRole('button', { name: 'Take it off' }).click()
await expect(page.locator('.recovery-keys li')).toHaveCount(1)
})
@@ -415,24 +454,25 @@ test('moderating: a label, and the queue', async () => {
await page.getByRole('link', { name: 'Moderation' }).click()
// Putting him out is already in the queue, on him.
const ejected = page.locator('.subject', { hasText: who.bob.did })
await expect(ejected.locator('.status')).toHaveText('open')
await expect(ejected.locator('.events')).toContainText('eject')
await expect(ejected.locator('.events')).toContainText('Put out')
await page.getByRole('button', { name: 'Label someone' }).click()
await page.getByRole('combobox', { name: 'Their handle' }).fill('bob.test')
await page.getByRole('textbox', { name: 'Label' }).fill('troll')
await page.getByRole('button', { name: 'Label them' }).click()
const subject = page.locator('.subject', { hasText: who.bob.did })
await expect(subject.locator('.status')).toHaveText('open')
await expect(subject.locator('.events')).toContainText('label: troll')
await expect(subject.locator('.events')).toContainText('Labelled: troll')
// Escalated with a note, it leaves the open queue for the escalated.
await subject.getByRole('textbox', { name: 'Note' }).fill('Asked him to stop')
await subject.getByRole('button', { name: 'Escalate' }).click()
await subject.getByRole('button', { name: 'Resolve' }).click()
const resolving = page.getByRole('dialog', { name: 'Resolve or escalate' }).filter({ visible: true })
await resolving.getByRole('textbox', { name: 'A note, if you like' }).fill('Asked him to stop')
await resolving.getByRole('button', { name: 'Escalate' }).click()
await expect(page.locator('.subject', { hasText: who.bob.did })).toHaveCount(0)
await page.goto(url('/g/hikers.groups.test/moderation?status=escalated'))
await expect(page.locator('.subject', { hasText: who.bob.did }).locator('.status')).toHaveText('escalated')
await expect(page.locator('.subject', { hasText: who.bob.did }).locator('.events')).toContainText('escalated: Asked him to stop')
await page.getByRole('navigation', { name: 'The queue' }).getByRole('link', { name: 'Escalated' }).click()
await expect(page.locator('.subject', { hasText: who.bob.did }).locator('.events')).toContainText('Escalated: Asked him to stop')
await page.locator('.subject', { hasText: who.bob.did }).getByRole('button', { name: 'Resolve' }).click()
await page.getByRole('dialog', { name: 'Resolve or escalate' }).filter({ visible: true }).getByRole('button', { name: 'Resolve' }).click()
await page.goto(url('/g/hikers.groups.test/moderation?status=resolved'))
await expect(page.locator('.subject', { hasText: who.bob.did }).locator('.status')).toHaveText('resolved')
await expect(page.locator('.subject', { hasText: who.bob.did }).locator('.events')).toContainText('Resolved')
})
test('signing an app in as her group', async () => {
@@ -479,7 +519,8 @@ test('connecting an AI app, and disconnecting it', async () => {
await page.goto(url('/g/riders.groups.test'))
await expect(page.locator('.ai-apps', { hasText: 'Pocket helper' })).toBeVisible()
await page.getByRole('button', { name: 'Disconnect Pocket helper' }).click()
await page.locator('.ai-apps', { hasText: 'Pocket helper' }).getByRole('button', { name: 'Disconnect' }).click()
await page.getByRole('dialog', { name: 'Disconnect Pocket helper?' }).getByRole('button', { name: 'Disconnect it' }).click()
await expect(page.getByText('No AI app connected yet')).toBeVisible()
expect((await client.tool(tokens.access_token, 'group_show', {})).status).toBe(401)
})
@@ -522,7 +563,11 @@ test('moving an account here to become a group', async () => {
test('signing out', async () => {
await page.goto(url('/'))
await page.getByRole('button', { name: 'Sign out' }).click()
// From her menu, under her handle: what is hers, and signing out last.
await page.getByRole('banner').getByText('@alice.test', { exact: true }).click()
const menu = page.locator('.user-menu .menu')
await expect(menu.getByRole('link')).toHaveText(['Your groups', 'Start a group', 'Move an account here'])
await menu.getByRole('button', { name: 'Sign out' }).click()
await expect(page.getByRole('banner').getByRole('button', { name: 'Sign in' })).toBeVisible()
await expect.poll(() => signedInAs(page)).toBe('')
})
harness/e2e/pages.mjs+1−1
@@ -70,7 +70,7 @@ export const signIn = async (page, name, from = page.getByRole('banner').getByRo
/// Who the header says is signed in: nothing for no one.
export const signedInAs = (page) =>
page
.locator('.sign-out .mono')
.locator('.user-menu summary .handle')
.textContent({ timeout: 1000 })
.then((t) => t.trim(), () => '')
harness/look/seeds/full.mjs+2−1
@@ -20,8 +20,9 @@ export default async ({ world, opensocial, ask, page, picture, who, exists }) =>
const p = await page('alice')
for (const [slot, png] of [['Avatar', picture(256, 256)], ['Banner', picture(1500, 500, [47, 122, 75], [246, 241, 234])]]) {
await p.goto(`${world.base}/g/${g}/settings`, { waitUntil: 'networkidle' })
await p.getByRole('button', { name: new RegExp(`^(Add|Change) the ${slot.toLowerCase()}$`) }).click()
await p.getByLabel(slot, { exact: true }).setInputFiles({ name: 'picture.png', mimeType: 'image/png', buffer: png })
await p.getByRole('button', { name: `Upload the ${slot.toLowerCase()}` }).click()
await p.getByRole('dialog').filter({ visible: true }).getByRole('button', { name: new RegExp(`the ${slot.toLowerCase()}$`) }).click()
await p.waitForLoadState('networkidle')
}
await p.context().close()
harness/look/look.mjs+5−3
@@ -176,13 +176,15 @@ async function signedIn(name) {
await page.goto(world.base, { waitUntil: 'networkidle' })
await page.getByRole('banner').getByRole('button', { name: 'Sign in' }).click()
const dialog = page.getByRole('dialog', { name: 'Sign in with your Atmosphere account' })
await dialog.getByRole('textbox', { name: 'Handle' }).fill(who[name].handle)
await dialog.getByRole('button', { name: 'Sign in' }).click()
// Sent as typed, under any accounts the field suggests.
const handle = dialog.getByRole('combobox', { name: 'Handle' })
await handle.fill(who[name].handle)
await handle.press('Enter')
await page.waitForURL((u) => u.origin === new URL(world.pds).origin)
await page.getByRole('textbox', { name: 'Password' }).fill(who[name].password)
await page.getByRole('button', { name: 'Sign in' }).click()
await page.getByRole('button', { name: /^(accept|authorize|allow)$/i }).click()
await page.locator('.sign-out').waitFor({ timeout: 30_000 })
await page.locator('.user-menu').waitFor({ timeout: 30_000 })
world.signedIn[name] = await context.storageState()
await context.close()
save()
lexicons/fyi/opensocial/defs.json+5−0
@@ -28,6 +28,11 @@
"createdAt": {
"type": "string",
"format": "datetime"
},
"actor": {
"type": "ref",
"ref": "#actorView",
"description": "Whom it invites, with their handle where it can be read: on listInvites."
}
}
},
web/src/lib/atoms/Avatar.svelte+12−3
web/src/lib/molecules/ConfirmDialog.sveltenew+26−0
web/src/lib/molecules/Dialog.svelte+4−4
web/src/lib/molecules/Empty.svelte+6−4
web/src/lib/molecules/FormDialog.sveltenew+31−0
web/src/lib/molecules/GroupRow.svelte+4−3
web/src/lib/molecules/HandleInput.svelte+1−1
web/src/lib/molecules/MemberRow.svelte+13−8
web/src/lib/molecules/Section.svelte+8−5
web/src/lib/molecules/SignIn.svelte+6−2
web/src/lib/molecules/SignOut.sveltedeleted+0−9
web/src/lib/molecules/Standing.svelte+16−8
web/src/lib/molecules/Tabs.sveltenew+11−0
web/src/lib/molecules/UserMenu.sveltenew+35−0
web/src/lib/organisms/AppPasswords.svelte+32−24
web/src/lib/organisms/ConnectedApps.svelte+9−5
web/src/lib/organisms/GroupActivity.sveltenew+19−0
web/src/lib/organisms/GroupApps.svelte+27−22
web/src/lib/organisms/GroupCard.svelte+12−13
web/src/lib/organisms/GroupList.svelte+5−3
web/src/lib/organisms/Invitations.svelte+14−7
web/src/lib/organisms/InviteDialog.svelte+6−12
web/src/lib/organisms/Invites.svelte+16−9
web/src/lib/organisms/JoinRequests.svelte+4−6
web/src/lib/organisms/LabelDialog.sveltenew+12−0
web/src/lib/organisms/LabelForm.sveltedeleted+0−10
web/src/lib/organisms/LinksEditor.sveltenew+31−0
web/src/lib/organisms/MemberList.svelte+34−28
web/src/lib/organisms/ModerationQueue.svelte+28−18
web/src/lib/organisms/NewGroupForm.svelte+1−1
web/src/lib/organisms/ProfileForm.svelte+4−14
web/src/lib/organisms/ProfilePictures.svelte+28−14
web/src/lib/organisms/RecoveryKeys.svelte+28−25
web/src/lib/organisms/RolesEditor.svelte+40−28
web/src/lib/organisms/RulesEditor.svelte+27−20
web/src/lib/organisms/SiteHeader.svelte+4−4
web/src/lib/organisms/Visibility.svelte+1−1
web/src/lib/server/settings.tsnew+258−0
web/src/lib/templates/Page.svelte+20−3
web/src/lib/dates.tsnew+17−0
web/src/routes/g/[handle]/moderation/+page.svelte+20−12
web/src/routes/g/[handle]/settings/apps/+page.server.tsnew+15−0
web/src/routes/g/[handle]/settings/apps/+page.sveltenew+28−0
web/src/routes/g/[handle]/settings/recovery/+page.server.tsnew+12−0
web/src/routes/g/[handle]/settings/recovery/+page.sveltenew+25−0
web/src/routes/g/[handle]/settings/roles/+page.server.tsnew+10−0
web/src/routes/g/[handle]/settings/roles/+page.sveltenew+16−0
web/src/routes/g/[handle]/settings/rules/+page.server.tsnew+10−0
web/src/routes/g/[handle]/settings/rules/+page.sveltenew+15−0
web/src/routes/g/[handle]/settings/+layout.server.tsnew+9−0
web/src/routes/g/[handle]/settings/+layout.sveltenew+27−0
web/src/routes/g/[handle]/settings/+page.server.ts+9−220
web/src/routes/g/[handle]/settings/+page.svelte+23−45
web/src/routes/g/[handle]/+page.svelte+6−6
web/src/routes/+error.sveltenew+17−0
web/src/routes/+page.svelte+14−16
web/src/app.css+101−39
web/src/tokens.css+16−0