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

+7 -2
View File
@@ -86,6 +86,7 @@ func (s *Server) handleDocSync(w http.ResponseWriter, r *http.Request) {
Hold []string `json:"hold"`
Release []string `json:"release"`
} `json:"leases"`
SkipLog bool `json:"skipLog"` // one-off changes (e.g. ticking a to-do in the overview) need no log
}
if err := json.NewDecoder(http.MaxBytesReader(w, r.Body, syncMaxBody)).Decode(&req); err != nil {
writeError(w, http.StatusBadRequest, "Ungültiges JSON")
@@ -149,12 +150,16 @@ func (s *Server) handleDocSync(w http.ResponseWriter, r *http.Request) {
s.afterDocChange(docID, req.Ops, resp.Results)
}
entries, head, err := s.store.GetDocOpsSince(docID, req.LastSeq, syncMaxLog)
logLimit := syncMaxLog
if req.SkipLog {
logLimit = 0
}
entries, head, err := s.store.GetDocOpsSince(docID, req.LastSeq, logLimit)
if err != nil {
writeError(w, http.StatusInternalServerError, err.Error())
return
}
if req.LastSeq > head {
if req.LastSeq > head && !req.SkipLog {
resp.Resync = true
entries = []storage.DocLogEntry{}
}