Merge chat, diary and notes into one kind of room #13

Closed
opened 2026-10-12 11:11:34 +09:00 by bot-genji1024 · 0 comments
Collaborator

Goal

Chat, diary and notes are already the same thing on Matrix: child rooms of the space with a com.genji1024.koto.kind of chat, diary or note. Only the client treats them differently (one chat with threads, one diary of titled cards newest first, many notes of comment cards). Make them one kind of room, all shown and used the same way:

  • One ルーム tab (with TO-DO and カレンダー) that opens on a list of rooms, most recent activity first, each with its last message and an unread count.
  • Every room opens in the chat view: messages, Slack-style threads, photos, reactions, read state, typing, edits. A message can optionally carry a title, which shows it as a card (what diary entries are today).
  • Any member can create a room (name and description). The room's creator and the admin can rename and delete it; anyone can edit the description (as notes today).

Decided with the owner: list order by recent activity, rooms created by any member, rename/delete by creator and admin, opening on the room list.

Data: no migration

  • Existing chat, diary and note rooms all become rooms as they are; new rooms get kind: "room". Nothing is rewritten on the server, so production data, other Matrix clients and the importer keep working.
  • Diary entries and note comments are already m.room.message events with koto's payload (title, body, images, original date) and show as titled cards or messages with a photo grid. Imported entries keep showing their original date.
  • Diary photos are also sent as m.image thread replies so other clients can see them; the room view hides those replies when they repeat the photos of the message they belong to, so they do not appear twice.
  • A room is listed when it is joined, carries a koto kind not marked deleted, points at the space (m.space.parent) and has not been unlinked from it (an empty m.space.child). Deleting marks the room deleted where the user has the power to, and unlinks it from the space, which every member may do (the space grants m.space.child at level 0 so members can link new rooms); that lets the admin also remove old notes created by members, where the admin has no power.
  • New rooms give power level 100 to both the creator and the space's admins, and level 0 for the topic. The admin's upgrade (ensureRootJoinable) stops creating a chat room and opens the topic to everyone in the rooms the admin owns (the old chat and diary). A brand-new community starts with one room, チャット.
  • Settings: the three tab labels (tabChat, tabDiary, tabNotes) become one, tabRooms (default ルーム).

Client

  • matrix/chat.ts reads both plain messages and titled ones (title, body, images, original date), edits keep the payload, deleting a titled message also redacts my own photo replies to it (not other people's replies, which stay under a placeholder as in the chat).
  • matrix/koto.ts: listing, creating, renaming, describing and deleting rooms; who may do what.
  • New pages/Rooms.tsx (list, new-room form, room header with description and menu) around the existing chat view; the composer gets a タイトル toggle that sends a titled message with its photos in one post.
  • Diary.tsx, Notes.tsx, EntryCard.tsx and useEntries.ts go; diary.ts keeps what the importer and reactions use.
  • Docs (README, architecture) updated.

Verification

Unit tests for reading titled messages and hiding repeated photo replies; typecheck, lint, build. The integration tests and E2E need a homeserver and are updated to the new API but cannot run in the environment this is written in; the behaviour is checked on the pull request's preview against the demo's data (which has chat, a diary and notes).

## Goal Chat, diary and notes are already the same thing on Matrix: child rooms of the space with a `com.genji1024.koto.kind` of `chat`, `diary` or `note`. Only the client treats them differently (one chat with threads, one diary of titled cards newest first, many notes of comment cards). Make them one kind of **room**, all shown and used the same way: - One **ルーム** tab (with TO-DO and カレンダー) that opens on a list of rooms, **most recent activity first**, each with its last message and an unread count. - Every room opens in the chat view: messages, Slack-style threads, photos, reactions, read state, typing, edits. A message can optionally carry a **title**, which shows it as a card (what diary entries are today). - **Any member** can create a room (name and description). The room's **creator and the admin** can rename and delete it; anyone can edit the description (as notes today). Decided with the owner: list order by recent activity, rooms created by any member, rename/delete by creator and admin, opening on the room list. ## Data: no migration - Existing `chat`, `diary` and `note` rooms all become rooms as they are; new rooms get `kind: "room"`. Nothing is rewritten on the server, so production data, other Matrix clients and the importer keep working. - Diary entries and note comments are already `m.room.message` events with koto's payload (title, body, images, original date) and show as titled cards or messages with a photo grid. Imported entries keep showing their original date. - Diary photos are also sent as `m.image` thread replies so other clients can see them; the room view hides those replies when they repeat the photos of the message they belong to, so they do not appear twice. - A room is listed when it is joined, carries a koto kind not marked deleted, points at the space (`m.space.parent`) and has not been unlinked from it (an empty `m.space.child`). Deleting marks the room deleted where the user has the power to, and unlinks it from the space, which every member may do (the space grants `m.space.child` at level 0 so members can link new rooms); that lets the admin also remove old notes created by members, where the admin has no power. - New rooms give power level 100 to both the creator and the space's admins, and level 0 for the topic. The admin's upgrade (`ensureRootJoinable`) stops creating a chat room and opens the topic to everyone in the rooms the admin owns (the old chat and diary). A brand-new community starts with one room, チャット. - Settings: the three tab labels (`tabChat`, `tabDiary`, `tabNotes`) become one, `tabRooms` (default ルーム). ## Client - `matrix/chat.ts` reads both plain messages and titled ones (title, body, images, original date), edits keep the payload, deleting a titled message also redacts my own photo replies to it (not other people's replies, which stay under a placeholder as in the chat). - `matrix/koto.ts`: listing, creating, renaming, describing and deleting rooms; who may do what. - New `pages/Rooms.tsx` (list, new-room form, room header with description and menu) around the existing chat view; the composer gets a タイトル toggle that sends a titled message with its photos in one post. - `Diary.tsx`, `Notes.tsx`, `EntryCard.tsx` and `useEntries.ts` go; `diary.ts` keeps what the importer and reactions use. - Docs (README, architecture) updated. ## Verification Unit tests for reading titled messages and hiding repeated photo replies; typecheck, lint, build. The integration tests and E2E need a homeserver and are updated to the new API but cannot run in the environment this is written in; the behaviour is checked on the pull request's preview against the demo's data (which has chat, a diary and notes).
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
genji1024/koto#13
No description provided.