41 lines
679 B
Go
Raw Normal View History

2018-11-12 01:41:46 +00:00
package main
import "github.com/animenotifier/arn"
func main() {
defer arn.Node.Close()
for entry := range arn.StreamEditLogEntries() {
if entry.Action != "create" {
continue
}
obj := entry.Object()
if obj == nil {
continue
}
draft, isDraftable := obj.(arn.Draftable)
2018-11-12 01:41:46 +00:00
if isDraftable && draft.GetIsDraft() {
continue
}
// We don't create activity entries for anything
// other than posts and threads.
if entry.ObjectType != "Post" && entry.ObjectType != "Thread" {
2018-11-12 01:41:46 +00:00
continue
}
activity := arn.NewActivityCreate(
entry.ObjectType,
entry.ObjectID,
entry.UserID,
)
activity.Created = entry.Created
activity.Save()
}
}