augmented import outputs and logging

This commit is contained in:
2026-02-28 23:07:06 -07:00
parent 9a3860f796
commit ec635b3d00
3 changed files with 9 additions and 1 deletions
+5 -1
View File
@@ -340,12 +340,13 @@ func VCIFImportMessages(ctx context.Context, r io.Reader, comm *database.Communi
}
// If we created the topic, the "zero post" was already posted, so skip it in this loop so we don't post it again.
skipPost := created
topicOK := 0
topicFail := 0
for _, pdata := range tdata.Posts {
if skipPost {
skipPost = false
continue
}
//
author, err := database.AmGetUserByName(ctx, pdata.Author, nil)
if err != nil {
author = loader
@@ -355,11 +356,14 @@ func VCIFImportMessages(ctx context.Context, r io.Reader, comm *database.Communi
err = augmentPost(ctx, post, &pdata, comm, loader, ipaddr)
}
if err == nil {
topicOK++
postCount++
} else {
topicFail++
scroll = append(scroll, fmt.Sprintf("Unable to post message %d to topic \"%s\": %v", pdata.Index, topic.Name, err))
}
}
scroll = append(scroll, fmt.Sprintf("In topic \"%s\": %d messages posted successfully, %d failed", topic.Name, topicOK, topicFail))
if created {
if tdata.Frozen {
err = topic.SetFrozen(ctx, true, loader, comm, ipaddr)