aboutsummaryrefslogtreecommitdiff
path: root/outboxPost.go
diff options
context:
space:
mode:
authorFChannel <>2021-07-15 13:49:29 -0700
committerFChannel <>2021-07-15 13:49:29 -0700
commit22ee823b6e9200317337941c2ad41ca9df9dd855 (patch)
tree8ff9518bb529ff476bf4d667ea3f72b4cba970a2 /outboxPost.go
parent26f59904f0f1d7a908969ad0f5846448b0e7451b (diff)
added auto follow for boards
Diffstat (limited to 'outboxPost.go')
-rw-r--r--outboxPost.go18
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)