aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.go31
1 files changed, 8 insertions, 23 deletions
diff --git a/main.go b/main.go
index fc8e8b1..cd730c4 100644
--- a/main.go
+++ b/main.go
@@ -1040,31 +1040,16 @@ 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 {
- aFollowers := GetActorCollection(e.Id + "/followers")
+ for _, e := range activity.To {
+ aFollowers := GetActorCollection(e + "/followers")
for _, k := range aFollowers.Items {
- bFollowing := GetActorCollection(k.Id + "/following")
- var isFollowingActor = false
- for _, n := range bFollowing.Items {
- if n.Id == activity.Actor.Id {
- isFollowingActor = true
- break
- }
- }
-
- if isFollowingActor {
- tempActivity.To = append(tempActivity.To, k.Id)
- }
+ activity.To = append(activity.To, k.Id)
}
-
- tempActivity.To = append(tempActivity.To, e.Id)
}
- for _, e := range tempActivity.To {
+ var nActivity Activity
+
+ for _, e := range activity.To {
var alreadyTo = false
for _, k := range nActivity.To {
if e == k || e == activity.Actor.Id {
@@ -1077,8 +1062,8 @@ func AddFollowersToActivity(db *sql.DB, activity Activity) Activity{
}
}
- activity.To = nActivity.To
-
+ activity.To = nActivity.To
+
return activity
}