41 lines
690 B
Go
Raw Normal View History

2018-11-12 01:41:46 +00:00
package main
2019-06-03 09:32:43 +00:00
import "github.com/animenotifier/notify.moe/arn"
2018-11-12 01:41:46 +00:00
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()
}
}