1
0
mirror of https://github.com/writeas/writefreely synced 2025-01-22 11:40:28 +01:00

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.
This commit is contained in:
Matt Baer 2019-04-05 18:50:18 -04:00
parent 5a0a3ce451
commit 4af9fa66aa

View File

@ -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)