refactor(notes): remove legacy whole-document saves; all block changes go through sync
MindSift CI & Docker Release / Build, Test in Container & Push (push) Successful in 1m14s

Phase 5 of the collaboration plan:
- Remove PATCH /documents/{id}/blocks, PatchDocumentBlocks, the
  DOC_BLOCKS_PATCHED event and its types, FlushDocumentState and
  LoadDocumentState. PUT /documents/{id} rejects blocks (400) and only
  changes title, icon, folder and pin; editors may now change title/icon.
- The to-do overview ticks via a single operation on /docs/{id}/sync
  (new skipLog flag). Task links set the block tick with a targeted
  operation and notify open editors; creating a linked task needs edit
  rights.
- Keep the three share tables: DocRole already decides centrally, and
  rewriting the visibility queries would only add risk (documented in plan).
- Tests adapted to the new paths; share e2e test now also ticks a to-do in
  the overview.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
sandrodachandClaude Opus 5.5 committed 2026-10-28 14:35:59 +01:00
1 parent 8b7a53daab
commit aea4324c20
18 files changed
+155 -376

No files matched your search

+1 -1
View File
@@ -26,7 +26,7 @@ Zwei Browser (Eigentümer und Bearbeiter) arbeiten in derselben Notiz. Geprüft
## share.e2e.mjs
Der Eigentümer teilt eine Notiz über den Freigabe-Dialog mit Rolle „Bearbeiten“; geprüft wird, dass die Freigabe als `write` gespeichert, im Dialog als „Bearbeiter“ angezeigt wird und der Empfänger die Notiz bearbeiten kann.
Der Eigentümer teilt eine Notiz über den Freigabe-Dialog mit Rolle „Bearbeiten“; geprüft wird, dass die Freigabe als `write` gespeichert, im Dialog als „Bearbeiter“ angezeigt wird und der Empfänger die Notiz bearbeiten kann. Zum Schluss hakt der Eigentümer ein To-Do in der To-Do-Übersicht ab.
## lock.e2e.mjs
+18 -1
View File
@@ -45,13 +45,18 @@ async function openDoc(browser, token, title) {
}
const TITLE = `Freigabe-Test ${Date.now()}`;
const TODO_ID = `fr_todo_${Date.now()}`;
const TODO_TEXT = `Rollup-Aufgabe ${Date.now()}`;
const main = async () => {
const admin = (await api(null, 'POST', '/api/v1/auth/login', { login: 'admin', password: 'admin' })).token;
const user = (await api(null, 'POST', '/api/v1/auth/login', { login: 'user', password: 'user' })).token;
const doc = await api(admin, 'POST', '/api/v1/documents', {
title: TITLE,
blocks: [{ id: `fr_${Date.now()}`, type: 'bullet', content: 'Vom Eigentümer', level: 0 }],
blocks: [
{ id: `fr_${Date.now()}`, type: 'bullet', content: 'Vom Eigentümer', level: 0 },
{ id: TODO_ID, type: 'todo', content: TODO_TEXT, level: 0 },
],
});
const browser = await chromium.launch();
@@ -97,6 +102,18 @@ const main = async () => {
}, 6000);
check(!!saved, 'Bearbeiter kann die geteilte Notiz bearbeiten');
// Ticking a to-do in the overview goes through the sync endpoint as well
await A.page.bringToFront();
await A.page.getByRole('button', { name: 'Schließen', exact: true }).last().click(); // the share dialog is still open
await A.page.locator('button:visible', { hasText: 'To-Dos' }).first().click();
await A.page.getByTitle('Alle To-Dos als einfache Liste').click();
await A.page.locator('div', { hasText: TODO_TEXT }).last().locator('button').first().click();
const ticked = await waitFor(async () => {
const s = await api(admin, 'GET', `/api/v1/docs/${doc.id}/snapshot`);
return s.blocks.find((b) => b.id === TODO_ID)?.props?.checked === true;
}, 5000);
check(!!ticked, 'Abhaken in der To-Do-Übersicht wird gespeichert');
await browser.close();
console.log(failures ? `${failures} FEHLGESCHLAGEN` : 'ALLE PRÜFUNGEN BESTANDEN');
process.exit(failures ? 1 : 0);