aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFChannel <=>2021-01-28 17:02:10 -0800
committerFChannel <=>2021-01-28 17:02:10 -0800
commite06b4e233382155808366538ed9075c3eeb351d2 (patch)
treed1214ad14ff428ff598680547bd33605ee4e4bb0
parent51521e934b6d80f3b7267410e592fbef3580012f (diff)
if OP, send to OP followers
-rw-r--r--CacheDatabase.go20
-rw-r--r--main.go5
2 files changed, 14 insertions, 11 deletions
diff --git a/CacheDatabase.go b/CacheDatabase.go
index cbb7cd1..e6a447b 100644
--- a/CacheDatabase.go
+++ b/CacheDatabase.go
@@ -628,22 +628,20 @@ func GetObjectImgsTotalCache(db *sql.DB, actor Actor) int{
}
func DeleteActorCache(db *sql.DB, actorID string) {
- query := `select id from cacheactivitystream where id in (select id from cacheactivitystream where actor=$1)`
+ query := `select id from cacheactivitystream where id in (select id from cacheactivitystream where actor=$1)`
- rows, err := db.Query(query, actorID)
+ rows, err := db.Query(query, actorID)
+ CheckError(err, "error selecting actors activity from cache")
+ defer rows.Close()
- CheckError(err, "error selecting actors activity from cache")
-
- defer rows.Close()
-
- for rows.Next() {
- var id string
- rows.Scan(&id)
+ for rows.Next() {
+ var id string
+ rows.Scan(&id)
- DeleteObjectFromCache(db, id)
- }
+ DeleteObjectFromCache(db, id)
+ }
}
func WriteActorToCache(db *sql.DB, actorID string) {
diff --git a/main.go b/main.go
index cd730c4..1085698 100644
--- a/main.go
+++ b/main.go
@@ -1040,6 +1040,11 @@ func CreateObject(objType string) ObjectBase {
}
func AddFollowersToActivity(db *sql.DB, activity Activity) Activity{
+
+ if len(activity.To) < 1 {
+ activity.To = append(activity.To, activity.Actor.Id)
+ }
+
for _, e := range activity.To {
aFollowers := GetActorCollection(e + "/followers")
for _, k := range aFollowers.Items {