2018-10-31 05:27:48 +00:00
|
|
|
package activity
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/aerogo/aero"
|
|
|
|
"github.com/animenotifier/notify.moe/components"
|
|
|
|
"github.com/animenotifier/notify.moe/utils"
|
|
|
|
)
|
|
|
|
|
|
|
|
const maxActivitiesPerPage = 40
|
|
|
|
|
|
|
|
// Get activity page.
|
|
|
|
func Get(ctx *aero.Context) string {
|
|
|
|
user := utils.GetUser(ctx)
|
|
|
|
|
2018-11-11 22:48:16 +00:00
|
|
|
// entries := arn.FilterEditLogEntries(func(entry *arn.EditLogEntry) bool {
|
|
|
|
// if entry.Action != "create" {
|
|
|
|
// return false
|
|
|
|
// }
|
2018-10-31 05:27:48 +00:00
|
|
|
|
2018-11-11 22:48:16 +00:00
|
|
|
// obj := entry.Object()
|
2018-11-05 04:19:42 +00:00
|
|
|
|
2018-11-11 22:48:16 +00:00
|
|
|
// if obj == nil {
|
|
|
|
// return false
|
|
|
|
// }
|
2018-11-05 04:19:42 +00:00
|
|
|
|
2018-11-11 22:48:16 +00:00
|
|
|
// _, isPostable := obj.(arn.Postable)
|
|
|
|
// return isPostable
|
|
|
|
// })
|
2018-10-31 05:27:48 +00:00
|
|
|
|
2018-11-11 22:48:16 +00:00
|
|
|
// arn.SortEditLogEntriesLatestFirst(entries)
|
2018-10-31 05:27:48 +00:00
|
|
|
|
2018-11-11 22:48:16 +00:00
|
|
|
// if len(entries) > maxActivitiesPerPage {
|
|
|
|
// entries = entries[:maxActivitiesPerPage]
|
|
|
|
// }
|
2018-10-31 05:27:48 +00:00
|
|
|
|
2018-11-11 22:48:16 +00:00
|
|
|
return ctx.HTML(components.ActivityFeed(nil, user))
|
2018-10-31 05:27:48 +00:00
|
|
|
}
|