From 1ee6552559141dd5dba91abec7c81d68c56abda0 Mon Sep 17 00:00:00 2001 From: FChannel <> Date: Mon, 2 May 2022 12:44:41 -0700 Subject: removed all unneeded .go files from root directory --- db/follow.go | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'db/follow.go') diff --git a/db/follow.go b/db/follow.go index 1aa9965..3f7868d 100644 --- a/db/follow.go +++ b/db/follow.go @@ -270,3 +270,35 @@ func MakeActivityRequest(activity activitypub.Activity) error { return nil } + +func SendToFollowers(actor string, activity activitypub.Activity) error { + nActor, err := activitypub.GetActorFromDB(actor) + if err != nil { + return err + } + + activity.Actor = &nActor + + followers, err := activitypub.GetActorFollowDB(actor) + if err != nil { + return err + } + + var to []string + + for _, e := range followers { + for _, k := range activity.To { + if e.Id != k { + to = append(to, e.Id) + } + } + } + + activity.To = to + + if len(activity.Object.InReplyTo) > 0 { + err = MakeActivityRequest(activity) + } + + return err +} -- cgit v1.2.3