diff --git a/pages/post/post.pixy b/pages/post/post.pixy index 95bdb3e3..90d193f0 100644 --- a/pages/post/post.pixy +++ b/pages/post/post.pixy @@ -4,4 +4,4 @@ component Post(post *arn.Post, user *arn.User) Postable(post.ToPostable(), user, "") .side-note.mountable - a(href=post.Thread().Link())= post.Thread().Title + a(href=post.Parent().Link())= post.Parent().TitleByUser(user) diff --git a/pages/search/search.go b/pages/search/search.go index cfcf5696..718f4939 100644 --- a/pages/search/search.go +++ b/pages/search/search.go @@ -72,6 +72,7 @@ func Characters(ctx *aero.Context) string { func Forum(ctx *aero.Context) string { term := ctx.Get("term") term = strings.TrimPrefix(term, "/") + user := utils.GetUser(ctx) var posts []*arn.Post var threads []*arn.Thread @@ -82,7 +83,7 @@ func Forum(ctx *aero.Context) string { threads = search.Threads(term, maxThreads) }) - return ctx.HTML(components.ForumSearchResults(posts, threads)) + return ctx.HTML(components.ForumSearchResults(posts, threads, user)) } // SoundTracks search. diff --git a/pages/search/search.pixy b/pages/search/search.pixy index 158ccdde..1f379f62 100644 --- a/pages/search/search.pixy +++ b/pages/search/search.pixy @@ -24,7 +24,7 @@ component SearchResults(term string, users []*arn.User, animes []*arn.Anime, pos span Forum #forum-search-results - ForumSearchResults(posts, threads) + ForumSearchResults(posts, threads, user) .widget h3.widget-title @@ -76,7 +76,7 @@ component CharacterSearchResults(characters []*arn.Character, user *arn.User) .mountable(data-mountable-type="character") CharacterSmall(character, user) -component ForumSearchResults(posts []*arn.Post, threads []*arn.Thread) +component ForumSearchResults(posts []*arn.Post, threads []*arn.Thread, user *arn.User) if len(posts) == 0 && len(threads) == 0 p.no-search-results.mountable No posts found. else @@ -92,7 +92,7 @@ component ForumSearchResults(posts []*arn.Post, threads []*arn.Thread) each post in posts .forum-search-result.mountable(data-mountable-type="forum") .forum-search-result-header - a.forum-search-result-title(href=post.Link(), data-mountable-type="forum")= post.Thread().Title + a.forum-search-result-title(href=post.Link(), data-mountable-type="forum")= post.Parent().TitleByUser(user) if post.Creator().HasNick() .forum-search-result-author= post.Creator().Nick .forum-search-result-sample= post.Text diff --git a/patches/update-post-structure/update-post-structure.go b/patches/update-post-structure/update-post-structure.go new file mode 100644 index 00000000..abc72642 --- /dev/null +++ b/patches/update-post-structure/update-post-structure.go @@ -0,0 +1,20 @@ +package main + +import ( + "github.com/animenotifier/arn" + "github.com/fatih/color" +) + +func main() { + color.Yellow("Updating post structure") + + defer color.Green("Finished.") + defer arn.Node.Close() + + // Iterate over the stream + for post := range arn.StreamPosts() { + post.ParentID = post.ThreadID + post.ParentType = "Thread" + post.Save() + } +}