fb_posts: edit and repost through the publisher's signed reschedule

POST /fbposts/{id}/reschedule {message, scheduled_for}. The site derives
the per-post signature from the stored cancel link and asks the publisher
to delete the post on Facebook and redraft the queue file; the row goes
to drafted with no Facebook id and no cancel link until the publisher's
next cycle reports the new one. Times must be at least 15 minutes out,
with an offset. An explicit null now clears fb_post_id on upsert; an
absent one still keeps it. tests/smoke_admin.py 160 -> 162.
This commit is contained in:
2026-09-04 19:57:40 -04:00
parent ea22ed53e7
commit b84fc7f064
3 changed files with 64 additions and 1 deletions
+3 -1
View File
@@ -1158,7 +1158,9 @@ def upsert_fb_post(rec, image=None):
fields["cancelled_at"] = rec.get("cancelled_at") or _now()
fields["cancelled_by"] = rec.get("cancelled_by") or "publisher"
if old:
if fields.get("fb_post_id") is None:
# A missing fb_post_id keeps the old one; an explicit null clears it
# (a redraft has no Facebook id until the next cycle).
if fields.get("fb_post_id") is None and "fb_post_id" not in rec:
fields.pop("fb_post_id")
sets = ", ".join("%s=?" % k for k in fields)
con.execute("UPDATE fb_posts SET %s WHERE id=?" % sets, (*fields.values(), pid))