From ccdbe6fda1c783be80e74fcb97a10bef8d0de24d Mon Sep 17 00:00:00 2001 From: FChannel <> Date: Sat, 9 Oct 2021 09:28:20 -0700 Subject: fix for federating issue when everyone is not following each other and comments are lost. --- outboxPost.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) 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) + } +} -- cgit v1.2.3