diff options
-rw-r--r-- | outboxPost.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/outboxPost.go b/outboxPost.go index 65b9929..22a0d1c 100644 --- a/outboxPost.go +++ b/outboxPost.go @@ -550,6 +550,7 @@ func ParseInboxRequest(w http.ResponseWriter, r *http.Request, db *sql.DB) { WriteObjectToCache(db, *activity.Object) ArchivePosts(db, GetActorFromDB(db, e)) + SendToFollowers(db, e, activity) } } } @@ -683,3 +684,26 @@ func IsMediaBanned(db *sql.DB, f multipart.File) bool { return false } + +func SendToFollowers(db *sql.DB, actor string, activity Activity) { + + nActor := GetActorFromDB(db, actor) + activity.Actor = &nActor + + followers := GetActorFollowDB(db, actor) + 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 { + MakeActivityRequest(db, activity) + } +} |