aboutsummaryrefslogtreecommitdiff
path: root/cacheDatabase.go
diff options
context:
space:
mode:
authorFChannel <>2021-06-06 00:07:31 -0700
committerFChannel <>2021-06-06 00:07:31 -0700
commit5ca02e417cb5e60b020c0e090ac56d1000aed1cd (patch)
treeed3812e6409be9ebc269ae6c9ef9576c669baa2f /cacheDatabase.go
parent84c008bc27510c63fb22d14c8559e05e12953418 (diff)
correct post ordering when following instance
Diffstat (limited to 'cacheDatabase.go')
-rw-r--r--cacheDatabase.go28
1 files changed, 27 insertions, 1 deletions
diff --git a/cacheDatabase.go b/cacheDatabase.go
index 380ade0..390e98e 100644
--- a/cacheDatabase.go
+++ b/cacheDatabase.go
@@ -30,6 +30,32 @@ func WriteObjectToCache(db *sql.DB, obj ObjectBase) ObjectBase {
return obj
}
+func WriteActorObjectToCache(db *sql.DB, obj ObjectBase) ObjectBase {
+ if len(obj.Attachment) > 0 {
+ if obj.Preview.Href != "" {
+ WritePreviewToCache(db, *obj.Preview)
+ }
+
+ for i, _ := range obj.Attachment {
+ WriteAttachmentToCache(db, obj.Attachment[i])
+ WriteActivitytoCacheWithAttachment(db, obj, obj.Attachment[i], *obj.Preview)
+ }
+
+ } else {
+ WriteActivitytoCache(db, obj)
+ }
+
+ WriteActorObjectReplyToDB(db, obj)
+
+ if obj.Replies != nil {
+ for _, e := range obj.Replies.OrderedItems {
+ WriteActorObjectToCache(db, e)
+ }
+ }
+
+ return obj
+}
+
func WriteActivitytoCache(db *sql.DB, obj ObjectBase) {
obj.Name = EscapeString(obj.Name)
@@ -232,7 +258,7 @@ func WriteActorToCache(db *sql.DB, actorID string) {
collection := GetActorCollection(actor.Outbox)
for _, e := range collection.OrderedItems {
- WriteObjectToCache(db, e)
+ WriteActorObjectToCache(db, e)
}
}