fix(triage): clean default blocks when converting thought/todo to workspace document
MindSift CI & Docker Release / Build, Test in Container & Push (push) Successful in 38s

This commit is contained in:
sandrodach committed 2026-10-25 01:57:32 +02:00
1 parent 3c550373eb
commit 1ada978f9e
1 file changed
+27 -5
+27 -5
View File
@@ -811,11 +811,33 @@ func (s *Store) UpdateThoughtTriage(userID, thoughtID, action, convertTo, target
if len(title) > 72 {
title = title[:72] + "…"
}
blocks := []domain.DocumentBlock{
{ID: domain.NewID("blk"), Type: "callout", Content: "Ursprünglicher Gedanke aus deiner Inbox vom " + thought.CreatedAt[:10]},
{ID: domain.NewID("blk"), Type: "paragraph", Content: thought.Content},
{ID: domain.NewID("blk"), Type: "h2", Content: "Nächste Schritte"},
{ID: domain.NewID("blk"), Type: "todo", Content: "Ersten Meilenstein definieren", Checked: false},
blocks := make([]domain.DocumentBlock, 0)
if strings.TrimSpace(thought.Notes) != "" {
blocks = append(blocks, domain.DocumentBlock{
ID: domain.NewID("blk"),
Type: "bullet",
Content: strings.TrimSpace(thought.Notes),
Level: 0,
})
}
if len(thought.Subtasks) > 0 {
for _, st := range thought.Subtasks {
blocks = append(blocks, domain.DocumentBlock{
ID: domain.NewID("blk"),
Type: "todo",
Content: st.Title,
Checked: st.IsCompleted,
Level: 0,
})
}
}
if len(blocks) == 0 {
blocks = append(blocks, domain.DocumentBlock{
ID: domain.NewID("blk"),
Type: "bullet",
Content: "",
Level: 0,
})
}
doc, err := s.CreateDocument(userID, "", title, "📄", "", blocks, thought.Tags, false)
if err == nil && doc != nil {