aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorFChannel <=>2021-01-26 11:54:53 -0800
committerFChannel <=>2021-01-26 11:54:53 -0800
commit2868cbabf7c394c637fc8568c6981da6eb5370ca (patch)
treeef485ab567241541e23c45f581e8c0493482c3b9 /main.go
parent4f42982f3bfa16a934fef2a6c5c6e4d153d45b4e (diff)
individual post view cache
Diffstat (limited to 'main.go')
-rw-r--r--main.go32
1 files changed, 17 insertions, 15 deletions
diff --git a/main.go b/main.go
index 90a2521..605314e 100644
--- a/main.go
+++ b/main.go
@@ -201,7 +201,7 @@ func main() {
}
if actorCatalog {
- collection, valid := WantToServe(db, actor.Id)
+ collection, valid := WantToServe(db, actor.Name)
if valid {
CatalogGet(w, r, db, collection)
}
@@ -1027,17 +1027,18 @@ func CreateObject(objType string) ObjectBase {
func AddFollowersToActivity(db *sql.DB, activity Activity) Activity{
followers := GetActorFollowDB(db, activity.Actor.Id)
-
+
var nActivity Activity
+ var tempActivity Activity
for _, e := range followers {
- var tempActivity Activity
aFollowers := GetActorCollection(e.Id + "/followers")
for _, k := range aFollowers.Items {
- bFollowers := GetActorCollection(k.Id + "/following")
+ bFollowing := GetActorCollection(k.Id + "/following")
var isFollowingActor = false
- for _, n := range bFollowers.Items {
+ for _, n := range bFollowing.Items {
if n.Id == activity.Actor.Id {
isFollowingActor = true
+ break
}
}
@@ -1047,19 +1048,20 @@ func AddFollowersToActivity(db *sql.DB, activity Activity) Activity{
}
tempActivity.To = append(tempActivity.To, e.Id)
- for _, k := range tempActivity.To {
- var alreadyTo = false
- for _, n := range nActivity.To {
- if k == n || k == activity.Actor.Id {
- alreadyTo = true
- }
- }
+ }
- if !alreadyTo {
- nActivity.To = append(nActivity.To, k)
+ for _, e := range tempActivity.To {
+ var alreadyTo = false
+ for _, k := range nActivity.To {
+ if e == k || e == activity.Actor.Id {
+ alreadyTo = true
}
}
- }
+
+ if !alreadyTo {
+ nActivity.To = append(nActivity.To, e)
+ }
+ }
activity.To = nActivity.To