Estate: lint order fixes, test title, harness out of prettier

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-31 17:48:31 +01:00
commit 1dfe38a33d
5 changed files with 17 additions and 16 deletions

View file

@ -2,4 +2,4 @@ dist
node_modules
package.json
package-lock.json
LICENSE
LICENSEharness

View file

@ -44,10 +44,10 @@ import { roomToUnreadAtom } from '../../state/room/roomToUnread';
import { AsyncStatus, useAsyncCallback } from '../../hooks/useAsyncCallback';
import { EstateRoom, EstateTier } from './buildEstate';
import { activateEstateRoom, awaitMyJoin } from './joinEstateRoom';
import { useEstate, useEstateRootId } from './useEstate';
/** How long a tap waits for the client store to hold the room it just joined. */
const JOIN_ARRIVAL_TIMEOUT_MS = 20000;
import { useEstate, useEstateRootId } from './useEstate';
const estateRoomPath = (mx: ReturnType<typeof useMatrixClient>, room: EstateRoom): string => {
const alias = getCanonicalAliasOrRoomId(mx, room.roomId);

View file

@ -90,7 +90,7 @@ describe('buildEstate', () => {
expect(tiers.flatMap((t) => [...t.loose, ...t.groups.flatMap((g) => g.rooms)])).toHaveLength(4);
});
it('groups rooms by steward Mind from the steward on each room's Space child entry', () => {
it('groups rooms by steward Mind from the steward on each Space child entry', () => {
const projects = buildEstate(input()).find((t) => t.id === PROJECTS)!;
expect(projects.groups.map((g) => [g.mind, g.rooms.map((r) => r.roomId)])).toEqual([
['eureka', ['!cultlib:gamecult.org']],

View file

@ -12,14 +12,6 @@
* invited-only member can read (she cannot read the Space's state).
*/
export type EstateHierarchyRoom = {
room_id: string;
name?: string;
canonical_alias?: string;
room_type?: string;
children_state?: { state_key: string; content?: SpaceChildContent }[];
};
export const STEWARD_KEY = 'org.gamecult.steward';
export type SpaceChildContent = {
@ -28,6 +20,14 @@ export type SpaceChildContent = {
[STEWARD_KEY]?: { mind?: unknown };
};
export type EstateHierarchyRoom = {
room_id: string;
name?: string;
canonical_alias?: string;
room_type?: string;
children_state?: { state_key: string; content?: SpaceChildContent }[];
};
export type EstateMembership = 'joined' | 'invited' | 'joinable';
export type EstateRoom = {

View file

@ -50,14 +50,15 @@ export const awaitMyJoin = (
resolve(true);
return;
}
const finish = (joined: boolean) => {
clearTimeout(timer);
mx.off('Room.myMembership', onMembership);
resolve(joined);
};
let finish: (joined: boolean) => void = () => undefined;
const onMembership = (room: { roomId: string }, membership: string) => {
if (room.roomId === roomId && membership === 'join') finish(true);
};
const timer = setTimeout(() => finish(false), timeoutMs);
finish = (joined) => {
clearTimeout(timer);
mx.off('Room.myMembership', onMembership);
resolve(joined);
};
mx.on('Room.myMembership', onMembership);
});