aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorFChannel <=>2021-01-25 19:09:17 -0800
committerFChannel <=>2021-01-25 19:09:17 -0800
commit4f9e3a9228e38e94b77a31878104f16315bb21d3 (patch)
treefdb1892b95a33188ca16982d8c95acdde4bdaabd /main.go
parentd94cbd3375df4cd01d068f56da1c6e4b0acd693c (diff)
send activity to all followers of To field
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
}