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
|
|
|
|
}
|
|
|
|
|
2018-11-12 05:24:00 +00:00
|
|
|
draft, isDraftable := obj.(arn.Draftable)
|
2018-11-12 01:41:46 +00:00
|
|
|
|
2018-11-12 05:24:00 +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()
|
|
|
|
}
|
|
|
|
}
|