aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go29
1 files changed, 21 insertions, 8 deletions
diff --git a/main.go b/main.go
index 55c97cd..95ed554 100644
--- a/main.go
+++ b/main.go
@@ -1027,20 +1027,33 @@ func CreateObject(objType string) ObjectBase {
func AddFollowersToActivity(db *sql.DB, activity Activity) Activity{
followers := GetActorFollowDB(db, activity.Actor.Id)
-
+
+ var nActivity Activity
for _, e := range followers {
- var alreadyTo = false
- for _, k := range activity.To {
- if k == e.Id {
- alreadyTo = true
- }
+ var tempActivity Activity
+ actor := GetActor(e.Id)
+ aFollowers := GetActorCollection(actor.Followers)
+ for _, k := range aFollowers.Items {
+ tempActivity.To = append(tempActivity.To, k.Id)
}
+ tempActivity.To = append(tempActivity.To, e.Id)
+
+ for _, k := range tempActivity.To {
+ var alreadyTo = false
+ for _, n := range nActivity.To {
+ if k == n {
+ alreadyTo = true
+ }
+ }
- if !alreadyTo {
- activity.To = append(activity.To, e.Id)
+ if !alreadyTo {
+ nActivity.To = append(nActivity.To, k)
+ }
}
}
+ activity.To = nActivity.To
+
return activity
}