diff --git a/pages/activity/activity.go b/pages/activity/activity.go index d180b14b..26617880 100644 --- a/pages/activity/activity.go +++ b/pages/activity/activity.go @@ -2,7 +2,6 @@ package activity import ( "github.com/aerogo/aero" - "github.com/animenotifier/arn" "github.com/animenotifier/notify.moe/components" "github.com/animenotifier/notify.moe/utils" ) @@ -13,33 +12,26 @@ const maxActivitiesPerPage = 40 func Get(ctx *aero.Context) string { user := utils.GetUser(ctx) - // posts := arn.AllPosts() - // arn.SortPostsLatestFirst(posts) + // entries := arn.FilterEditLogEntries(func(entry *arn.EditLogEntry) bool { + // if entry.Action != "create" { + // return false + // } - // posts := arn.FilterPosts(func(post *arn.Post) bool { - // return post. + // obj := entry.Object() + + // if obj == nil { + // return false + // } + + // _, isPostable := obj.(arn.Postable) + // return isPostable // }) - entries := arn.FilterEditLogEntries(func(entry *arn.EditLogEntry) bool { - if entry.Action != "create" { - return false - } + // arn.SortEditLogEntriesLatestFirst(entries) - obj := entry.Object() + // if len(entries) > maxActivitiesPerPage { + // entries = entries[:maxActivitiesPerPage] + // } - if obj == nil { - return false - } - - _, isPostable := obj.(arn.Postable) - return isPostable - }) - - arn.SortEditLogEntriesLatestFirst(entries) - - if len(entries) > maxActivitiesPerPage { - entries = entries[:maxActivitiesPerPage] - } - - return ctx.HTML(components.ActivityFeed(entries, user)) + return ctx.HTML(components.ActivityFeed(nil, user)) } diff --git a/pages/activity/activity.pixy b/pages/activity/activity.pixy index 81f04fe0..01f4b616 100644 --- a/pages/activity/activity.pixy +++ b/pages/activity/activity.pixy @@ -1,12 +1,22 @@ -component ActivityFeed(entries []*arn.EditLogEntry, user *arn.User) +component ActivityFeed(entries []*arn.Activity, user *arn.User) h1 Activity .activities each entry in entries - ActivityPost(entry.Object().(arn.Postable), user) + Activity(entry, user) -component ActivityPost(post arn.Postable, user *arn.User) - if post.Parent() != nil - Postable(post, user, false, fmt.Sprintf(`

%s

`, post.Parent().Link(), html.EscapeString(post.Parent().TitleByUser(user))), "") - else - Postable(post, user, false, fmt.Sprintf(`

%s

`, post.Link(), html.EscapeString(post.TitleByUser(user))), "") \ No newline at end of file +component Activity(activity *arn.Activity, user *arn.User) + h1= activity.Text() + +//- component ActivityFeed(entries []*arn.EditLogEntry, user *arn.User) +//- h1 Activity + +//- .activities +//- each entry in entries +//- ActivityPost(entry.Object().(arn.Postable), user) + +//- component ActivityPost(post arn.Postable, user *arn.User) +//- if post.Parent() != nil +//- Postable(post, user, false, fmt.Sprintf(`

%s

`, post.Parent().Link(), html.EscapeString(post.Parent().TitleByUser(user))), "") +//- else +//- Postable(post, user, false, fmt.Sprintf(`

%s

`, post.Link(), html.EscapeString(post.TitleByUser(user))), "") \ No newline at end of file