From 63b536ec8771a30fd9e528b8d9a3389f8af2a2d7 Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Sun, 16 Jun 2019 20:34:32 -0400 Subject: [PATCH] Don't federate anything when instance is private Ref T576 --- posts.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/posts.go b/posts.go index 7fd6635..306a2c4 100644 --- a/posts.go +++ b/posts.go @@ -586,7 +586,7 @@ func newPost(app *App, w http.ResponseWriter, r *http.Request) error { // Write success now response := impart.WriteSuccess(w, newPost, http.StatusCreated) - if newPost.Collection != nil && app.cfg.App.Federation && !newPost.Created.After(time.Now()) { + if newPost.Collection != nil && !app.cfg.App.Private && app.cfg.App.Federation && !newPost.Created.After(time.Now()) { go federatePost(app, newPost, newPost.Collection.ID, false) } @@ -686,7 +686,7 @@ func existingPost(app *App, w http.ResponseWriter, r *http.Request) error { if pRes.CollectionID.Valid { coll, err := app.db.GetCollectionBy("id = ?", pRes.CollectionID.Int64) - if err == nil && app.cfg.App.Federation { + if err == nil && !app.cfg.App.Private && app.cfg.App.Federation { pRes.Collection = &CollectionObj{Collection: *coll} go federatePost(app, pRes, pRes.Collection.ID, true) } @@ -826,7 +826,7 @@ func deletePost(app *App, w http.ResponseWriter, r *http.Request) error { if t != nil { t.Commit() } - if coll != nil && app.cfg.App.Federation { + if coll != nil && !app.cfg.App.Private && app.cfg.App.Federation { go deleteFederatedPost(app, pp, collID.Int64) } @@ -870,7 +870,7 @@ func addPost(app *App, w http.ResponseWriter, r *http.Request) error { return err } - if app.cfg.App.Federation { + if !app.cfg.App.Private && app.cfg.App.Federation { for _, pRes := range *res { if pRes.Code != http.StatusOK { continue