diff options
author | FChannel <> | 2022-05-02 12:44:41 -0700 |
---|---|---|
committer | FChannel <> | 2022-06-19 12:53:29 -0700 |
commit | 1ee6552559141dd5dba91abec7c81d68c56abda0 (patch) | |
tree | 4ac21571a27980e8ebf83a065c270b36cc3ecfd6 /db/follow.go | |
parent | 733f911fadc872933481bcbe087d519ce00372df (diff) |
removed all unneeded .go files from root directory
Diffstat (limited to 'db/follow.go')
-rw-r--r-- | db/follow.go | 32 |
1 files changed, 32 insertions, 0 deletions
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 +} |