diff options
Diffstat (limited to 'outboxPost.go')
-rw-r--r-- | outboxPost.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/outboxPost.go b/outboxPost.go index 45093b8..88c85e1 100644 --- a/outboxPost.go +++ b/outboxPost.go @@ -555,6 +555,24 @@ func ParseInboxRequest(w http.ResponseWriter, r *http.Request, db *sql.DB) { response := AcceptFollow(activity) response = SetActorFollowerDB(db, response) MakeActivityRequest(db, response) + + alreadyFollow := false + autoSub := GetActorAutoSubscribeDB(db, response.Actor.Id) + following := GetActorFollowingDB(db, response.Actor.Id) + + for _, e := range following { + if e.Id == activity.Actor.Id { + alreadyFollow = true + } + } + + if autoSub && !alreadyFollow { + followActivity := MakeFollowActivity(db, response.Actor.Id, response.Object.Actor) + + if FingerActor(response.Object.Actor).Id != "" { + MakeActivityRequestOutbox(db, followActivity) + } + } } else { fmt.Println("follow request for rejected") response := RejectActivity(activity) |