diff options
author | FChannel <=> | 2021-01-25 19:09:17 -0800 |
---|---|---|
committer | FChannel <=> | 2021-01-25 19:09:17 -0800 |
commit | 4f9e3a9228e38e94b77a31878104f16315bb21d3 (patch) | |
tree | fdb1892b95a33188ca16982d8c95acdde4bdaabd /main.go | |
parent | d94cbd3375df4cd01d068f56da1c6e4b0acd693c (diff) |
send activity to all followers of To field
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 29 |
1 files changed, 21 insertions, 8 deletions
@@ -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 } |