diff options
author | FChannel <=> | 2021-02-16 01:11:55 -0800 |
---|---|---|
committer | FChannel <=> | 2021-02-16 01:11:55 -0800 |
commit | 38f01c1910c57af62ea362c37ad3ac2de5b24253 (patch) | |
tree | 1797446329cba7fcf046d75c42d4f1f956c213b7 /outboxGet.go | |
parent | 549e974b9911723b52503e1fde81ce0944e8b76e (diff) |
cut down catalog query to only grab op
Diffstat (limited to 'outboxGet.go')
-rw-r--r-- | outboxGet.go | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/outboxGet.go b/outboxGet.go index a42a3d7..8ee6587 100644 --- a/outboxGet.go +++ b/outboxGet.go @@ -40,6 +40,24 @@ func GetObjectsFromFollow(db *sql.DB, actor Actor) []ObjectBase { return followObj } +func GetObjectsFromFollowCatalog(db *sql.DB, actor Actor) []ObjectBase { + var followingCol Collection + var followObj []ObjectBase + followingCol = GetActorCollection(actor.Following) + for _, e := range followingCol.Items { + var followOutbox Collection + if !IsActorLocal(db, e.Id) { + followOutbox = GetObjectFromCacheCatalog(db, e.Id) + } else { + followOutbox = GetObjectFromDBCatalog(db, e.Id) + } + for _, e := range followOutbox.OrderedItems { + followObj = append(followObj, e) + } + } + return followObj +} + func GetCollectionFromPath(db *sql.DB, path string) Collection { var nColl Collection @@ -71,7 +89,7 @@ func GetCollectionFromPath(db *sql.DB, path string) Collection { var imgCnt int post.Replies, postCnt, imgCnt = GetObjectRepliesDB(db, post) - post.Replies.TotalItems, post.Replies.TotalImgs = GetObjectRepliesDBCount(db, post) + post.Replies.TotalItems, post.Replies.TotalImgs = GetObjectRepliesCount(db, post) post.Replies.TotalItems = post.Replies.TotalItems + postCnt post.Replies.TotalImgs = post.Replies.TotalImgs + imgCnt @@ -117,7 +135,7 @@ func GetObjectFromPath(db *sql.DB, path string) ObjectBase{ nObj.Replies, postCnt, imgCnt = GetObjectRepliesDB(db, nObj) - nObj.Replies.TotalItems, nObj.Replies.TotalImgs = GetObjectRepliesDBCount(db, nObj) + nObj.Replies.TotalItems, nObj.Replies.TotalImgs = GetObjectRepliesCount(db, nObj) nObj.Replies.TotalItems = nObj.Replies.TotalItems + postCnt nObj.Replies.TotalImgs = nObj.Replies.TotalImgs + imgCnt |