fix: avoid outgoing ops during remote template apply
This commit is contained in:
parent
0c0b0d98c7
commit
e2aad19cc4
|
|
@ -207,7 +207,6 @@ func (a *App) ensureTemplateChildren(nodeID, templateID, parentFsPath, title str
|
|||
_ = os.MkdirAll(fullPath, 0o755)
|
||||
|
||||
_ = a.activity.Record(nodeID, activity.TargetFolder, childNode.ID, "", activity.TypeNodeCreated, folderName, "")
|
||||
_ = a.sync.RecordOp(syncsvc.EntityFolder, childNode.ID, syncsvc.OpCreate, nodePayload(childNode))
|
||||
}
|
||||
|
||||
for _, df := range tmpl.DefaultFiles {
|
||||
|
|
@ -245,18 +244,6 @@ func (a *App) ensureTemplateChildren(nodeID, templateID, parentFsPath, title str
|
|||
`INSERT OR IGNORE INTO notes (node_id, file_id, format) VALUES (?,?,?)`,
|
||||
childNode.ID, fileID, "markdown")
|
||||
_ = a.activity.Record(nodeID, activity.TargetNote, childNode.ID, "", activity.TypeNoteCreated, fileTitle, "")
|
||||
_ = a.sync.RecordOp(syncsvc.EntityNote, childNode.ID, syncsvc.OpCreate, map[string]interface{}{
|
||||
"node_id": childNode.ID,
|
||||
"parent_id": nodeID,
|
||||
"title": fileTitle,
|
||||
"file_id": fileID,
|
||||
"format": "markdown",
|
||||
"content": content,
|
||||
"filename": filepath.Base(fpath),
|
||||
"path": relPath,
|
||||
"created_at": nowRFC,
|
||||
"updated_at": nowRFC,
|
||||
})
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1448,6 +1448,14 @@ func TestVaultLayout_TemplateChildrenBackwardCompat(t *testing.T) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
ops, err := app.sync.GetUnpushedOps()
|
||||
if err != nil {
|
||||
t.Fatalf("get unpushed ops: %v", err)
|
||||
}
|
||||
if len(ops) != 0 {
|
||||
t.Fatalf("remote template apply recorded %d outgoing sync ops, want 0", len(ops))
|
||||
}
|
||||
}
|
||||
|
||||
// --- helpers ---
|
||||
|
|
|
|||
Loading…
Reference in New Issue