diff options
author | FChannel <=> | 2021-01-25 19:36:13 -0800 |
---|---|---|
committer | FChannel <=> | 2021-01-25 19:36:13 -0800 |
commit | 4fed11e91912f8c50808d281c5ed8eaf62fae956 (patch) | |
tree | 83f145c591ad94c007efbffc8dc90034036809f4 | |
parent | 613b454b1208db3ce30865901f60f365513829d9 (diff) |
activity To logic for followers to send to
-rw-r--r-- | main.go | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -1031,13 +1031,22 @@ func AddFollowersToActivity(db *sql.DB, activity Activity) Activity{ var nActivity Activity for _, e := range followers { var tempActivity Activity - actor := GetActor(e.Id) - aFollowers := GetActorCollection(actor.Followers) + aFollowers := GetActorCollection(e.Id + "/followers") for _, k := range aFollowers.Items { - tempActivity.To = append(tempActivity.To, k.Id) + bFollowers := GetActorCollection(k.Id + "/followers") + var isFollowingActor = false + for _, n := range bFollowers.Items { + if n.Id == activity.Actor.Id { + isFollowingActor = true + } + } + + if isFollowingActor { + 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 { |