aboutsummaryrefslogtreecommitdiff
path: root/db/database.go
diff options
context:
space:
mode:
authorFChannel <>2022-04-24 00:46:49 -0700
committerFChannel <>2022-06-19 12:53:29 -0700
commit3db517715bef6a53225c5c3c06e8fc5fd0bf71e3 (patch)
tree9aa7fbcb12f2ec8d0e4e66cd85ace058e38dd32d /db/database.go
parent9718d34a757b66917747c1c4acfb9b35d154625b (diff)
basic pass over view posts, post, catalog and manage page connections
Diffstat (limited to 'db/database.go')
-rw-r--r--db/database.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/db/database.go b/db/database.go
index 0b44404..db7e715 100644
--- a/db/database.go
+++ b/db/database.go
@@ -858,6 +858,7 @@ func GetObjectFromDBCatalog(id string) (activitypub.Collection, error) {
query := `select x.id, x.name, x.content, x.type, x.published, x.updated, x.attributedto, x.attachment, x.preview, x.actor, x.tripcode, x.sensitive from (select id, name, content, type, published, updated, attributedto, attachment, preview, actor, tripcode, sensitive from activitystream where actor=$1 and id in (select id from replies where inreplyto='') and type='Note' union select id, name, content, type, published, updated, attributedto, attachment, preview, actor, tripcode, sensitive from activitystream where actor in (select following from following where id=$1) and id in (select id from replies where inreplyto='') and type='Note' union select id, name, content, type, published, updated, attributedto, attachment, preview, actor, tripcode, sensitive from cacheactivitystream where actor in (select following from following where id=$1) and id in (select id from replies where inreplyto='') and type='Note') as x order by x.updated desc limit 165`
rows, err := db.Query(query, id)
+
if err != nil {
return nColl, err
}
@@ -880,6 +881,7 @@ func GetObjectFromDBCatalog(id string) (activitypub.Collection, error) {
post.Replies = &replies
post.Replies.TotalItems, post.Replies.TotalImgs, err = GetObjectRepliesCount(post)
+
if err != nil {
return nColl, err
}
@@ -1229,8 +1231,9 @@ func GetObjectRepliesCount(parent activitypub.ObjectBase) (int, int, error) {
defer rows.Close()
- rows.Next()
- err = rows.Scan(&countId, &countImg)
+ for rows.Next() {
+ err = rows.Scan(&countId, &countImg)
+ }
return countId, countImg, err
}