Commit graph

4 commits

Author SHA1 Message Date
Paulo Castellano
bd3a349f56
fix: skip removed social accounts when duplicating posts (#226)
* fix: skip removed social accounts when duplicating posts

DuplicatePost was copying orphan post_platform rows left after disconnect
(null social_account_id with snapshot name/username/avatar), which showed
broken avatars in the draft editor. Skip platforms without a live account.

Co-authored-by: Paulo Castellano <hello@paulocastellano.com>

* refactor: filter duplicate platforms with whereHas

Use whereHas('socialAccount') instead of null checks in the loop.

Co-authored-by: Paulo Castellano <hello@paulocastellano.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-08-03 13:04:42 -03:00
Paulo Castellano
d1d38865ef Dispatch PostCreated from PostObserver on every create.
Centralize provenance/broadcast/PostHog triggers so CreatePost and DuplicatePost no longer fire the event by hand.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-24 12:01:01 -03:00
Paulo Castellano
8b1ce057c3 Fire PostCreated on duplicate and drop unused PostHog eager load.
Duplicates now sync usage and track post.created like CreatePost; TrackPost only eager-loads what capture needs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-24 11:56:44 -03:00
Paulo Castellano
459f4dd5a5 Harden created_via: require it, cover duplicate and all entry points.
Reject CreatePost calls without CreatedVia, set Web on DuplicatePost, and assert wiring for templates, AI, automation, and API spoof attempts.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-24 11:30:15 -03:00