Minor fix

This commit is contained in:
Eduard Urbach 2018-10-29 09:28:24 +09:00
parent 9aa3d9de62
commit f4f1531b8b

View File

@ -12,12 +12,16 @@ func main() {
// Iterate over the stream // Iterate over the stream
for post := range arn.StreamPosts() { for post := range arn.StreamPosts() {
_, found := threadToPosts[post.ThreadID] if post.ParentType != "Thread" {
continue
}
_, found := threadToPosts[post.ParentID]
if !found { if !found {
threadToPosts[post.ThreadID] = []string{post.ID} threadToPosts[post.ParentID] = []string{post.ID}
} else { } else {
threadToPosts[post.ThreadID] = append(threadToPosts[post.ThreadID], post.ID) threadToPosts[post.ParentID] = append(threadToPosts[post.ParentID], post.ID)
} }
} }
@ -26,7 +30,7 @@ func main() {
thread, err := arn.GetThread(threadID) thread, err := arn.GetThread(threadID)
arn.PanicOnError(err) arn.PanicOnError(err)
thread.Posts = posts thread.PostIDs = posts
thread.Save() thread.Save()
} }
} }