From 4af9fa66aa10c7fa57cc8a6666e00744db435786 Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Fri, 5 Apr 2019 18:50:18 -0400 Subject: [PATCH] Don't federate scheduled posts upon claiming Previously, moving an anonymous post to a blog would instantly federate the post, regardless of its `created` date. This now respects that value and doesn't federate the post if its `created` date is in the future. This is the first part of supporting scheduled, federated posts (ref T567) but technically fixes #76. --- posts.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/posts.go b/posts.go index 4f5ca8d..b21588c 100644 --- a/posts.go +++ b/posts.go @@ -871,7 +871,9 @@ func addPost(app *app, w http.ResponseWriter, r *http.Request) error { if pRes.Code != http.StatusOK { continue } - go federatePost(app, pRes.Post, pRes.Post.Collection.ID, false) + if !pRes.Post.Created.After(time.Now()) { + go federatePost(app, pRes.Post, pRes.Post.Collection.ID, false) + } } } return impart.WriteSuccess(w, res, http.StatusOK)