From 86a128483bb8f9ea53d0f2aa13adb78d46e2b03f Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Thu, 20 Jun 2019 21:08:30 -0400 Subject: [PATCH] Fix more missing hostNames This fixes places, especially around federation, where the Collection's `hostName` wasn't set. --- activitypub.go | 1 + posts.go | 3 +++ 2 files changed, 4 insertions(+) diff --git a/activitypub.go b/activitypub.go index 0ac4d0c..997609d 100644 --- a/activitypub.go +++ b/activitypub.go @@ -522,6 +522,7 @@ func deleteFederatedPost(app *App, p *PublicPost, collID int64) error { if debugging { log.Info("Deleting federated post!") } + p.Collection.hostName = app.cfg.App.Host actor := p.Collection.PersonObject(collID) na := p.ActivityObject() diff --git a/posts.go b/posts.go index 0efa5ec..228c7e5 100644 --- a/posts.go +++ b/posts.go @@ -564,6 +564,7 @@ func newPost(app *App, w http.ResponseWriter, r *http.Request) error { if err != nil { return err } + coll.hostName = app.cfg.App.Host if coll.OwnerID != u.ID { return ErrForbiddenCollection } @@ -687,6 +688,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 { + coll.hostName = app.cfg.App.Host pRes.Collection = &CollectionObj{Collection: *coll} go federatePost(app, pRes, pRes.Collection.ID, true) } @@ -876,6 +878,7 @@ func addPost(app *App, w http.ResponseWriter, r *http.Request) error { continue } if !pRes.Post.Created.After(time.Now()) { + pRes.Post.Collection.hostName = app.cfg.App.Host go federatePost(app, pRes.Post, pRes.Post.Collection.ID, false) } }