From 4fed11e91912f8c50808d281c5ed8eaf62fae956 Mon Sep 17 00:00:00 2001 From: FChannel <=> Date: Mon, 25 Jan 2021 19:36:13 -0800 Subject: activity To logic for followers to send to --- main.go | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index 4a5ec35..7c31bbb 100644 --- a/main.go +++ b/main.go @@ -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 { -- cgit v1.2.3