diff options
author | FChannel <> | 2021-07-15 13:49:29 -0700 |
---|---|---|
committer | FChannel <> | 2021-07-15 13:49:29 -0700 |
commit | 22ee823b6e9200317337941c2ad41ca9df9dd855 (patch) | |
tree | 8ff9518bb529ff476bf4d667ea3f72b4cba970a2 /outboxPost.go | |
parent | 26f59904f0f1d7a908969ad0f5846448b0e7451b (diff) |
added auto follow for boards
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) |