diff options
author | FChannel <> | 2021-07-31 11:42:59 -0700 |
---|---|---|
committer | FChannel <> | 2021-07-31 11:42:59 -0700 |
commit | ac288d40da3235b9382d685c9958ad167a758bcd (patch) | |
tree | 676b11c79625a0ec5a6a0c6a52b94f89e1fe72e8 /outboxGet.go | |
parent | f0ce5bc6d4146bc1191b8f8428c387a9085217e5 (diff) |
added archive page and viewing
Diffstat (limited to 'outboxGet.go')
-rw-r--r-- | outboxGet.go | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/outboxGet.go b/outboxGet.go index 4064f0b..f656b3e 100644 --- a/outboxGet.go +++ b/outboxGet.go @@ -9,7 +9,7 @@ func GetActorOutbox(w http.ResponseWriter, r *http.Request, db *sql.DB) { actor := GetActorFromPath(db, r.URL.Path, "/") var collection Collection - collection.OrderedItems = GetObjectFromDB(db, actor.Id).OrderedItems + collection.OrderedItems = GetActorObjectCollectionFromDB(db, actor.Id).OrderedItems collection.AtContext.Context = "https://www.w3.org/ns/activitystreams" collection.Actor = &actor @@ -32,17 +32,17 @@ func GetCollectionFromPath(db *sql.DB, path string) Collection { rows, err := db.Query(query, path) CheckError(err, "error query collection path from db") - + defer rows.Close() for rows.Next(){ var actor Actor var post ObjectBase var attachID string - var previewID string - + var previewID string + err = rows.Scan(&post.Id, &post.Name, &post.Content, &post.Type, &post.Published, &post.AttributedTo, &attachID, &previewID, &actor.Id) - + CheckError(err, "error scan object into post struct from path") post.Actor = actor.Id @@ -50,13 +50,13 @@ func GetCollectionFromPath(db *sql.DB, path string) Collection { post.InReplyTo = GetInReplyToDB(db, post) var postCnt int - var imgCnt int + var imgCnt int post.Replies, postCnt, imgCnt = GetObjectRepliesDB(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 + post.Replies.TotalImgs = post.Replies.TotalImgs + imgCnt post.Attachment = GetObjectAttachment(db, attachID) @@ -65,11 +65,11 @@ func GetCollectionFromPath(db *sql.DB, path string) Collection { result = append(result, post) } - nColl.AtContext.Context = "https://www.w3.org/ns/activitystreams" + nColl.AtContext.Context = "https://www.w3.org/ns/activitystreams" nColl.OrderedItems = result - return nColl + return nColl } func GetObjectFromPath(db *sql.DB, path string) ObjectBase{ @@ -81,7 +81,7 @@ func GetObjectFromPath(db *sql.DB, path string) ObjectBase{ rows, err := db.Query(query, path) CheckError(err, "error query collection path from db") - + defer rows.Close() rows.Next() var attachID string @@ -89,9 +89,9 @@ func GetObjectFromPath(db *sql.DB, path string) ObjectBase{ var nActor Actor nObj.Actor = nActor.Id - + err = rows.Scan(&nObj.Id, &nObj.Name, &nObj.Content, &nObj.Type, &nObj.Published, &nObj.AttributedTo, &attachID, &previewID, &nObj.Actor) - + CheckError(err, "error scan object into post struct from path") var postCnt int @@ -102,11 +102,11 @@ func GetObjectFromPath(db *sql.DB, path string) ObjectBase{ nObj.Replies.TotalItems, nObj.Replies.TotalImgs = GetObjectRepliesCount(db, nObj) nObj.Replies.TotalItems = nObj.Replies.TotalItems + postCnt - nObj.Replies.TotalImgs = nObj.Replies.TotalImgs + imgCnt + nObj.Replies.TotalImgs = nObj.Replies.TotalImgs + imgCnt nObj.Attachment = GetObjectAttachment(db, attachID) nObj.Preview = GetObjectPreview(db, previewID) - return nObj + return nObj } |