trypost/app/Http/Controllers/App
Paulo Castellano 3f6032c152 fix(facebook): empty-message rejection + state consistency + no re-publish on terminal
Production incident: a customer's Facebook Page post failed with 'The post
is empty. Please enter a message to share.' (error code 197) and ended up
with a contradictory DB state (status=published + error_message=set).

Three independent bugs were uncovered:

A. FacebookPublisher sends 'message'/'description' as null when the user
   posts media without text. Graph API requires the key be omitted, not
   null. Fixed in publishSingleImagePost, publishMultiImagePost,
   publishVideoPost, publishReel.

B. markAsPublished/markAsFailed leak stale fields across transitions
   (a published row could retain error_message from a prior failure,
   vice-versa). Both transitions now explicitly clear the opposite
   side's fields.

C. status='failed' was editable in the UI and the backend, so users
   were re-clicking Publish, generating duplicate failure emails and
   the contradictory state from bug B. The frontend isReadOnly check
   and the UpdatePost backend guard now treat Published/PartiallyPublished/
   Failed/Publishing as terminal. To retry, the user duplicates the post.

11 new tests guarantee these can't regress silently: FB payload shape
per content type, PostPlatform field-clearing on transitions, and the
terminal-status block at the controller level.
2026-05-19 12:47:18 -03:00
..
Settings fix(profile): member delete must not destroy the shared account (closes #50) 2026-05-19 12:20:49 -03:00
AnalyticsController.php feat: add YouTube Analytics with 7 channel metrics 2026-04-14 13:10:27 -03:00
ApiKeyController.php feat: migrate custom API token implementation to Laravel Passport for authentication and token management 2026-05-03 18:38:17 -03:00
AssetController.php refactor: centralize media size limits in config + drop Document type 2026-05-04 14:54:47 -03:00
BillingController.php feat(subscribe): direct subscription, no trial on /subscribe 2026-05-14 20:05:39 -03:00
Controller.php refactor: restructure to Actions, subdomain routes (app/api), API tokens 2026-03-29 19:24:28 -03:00
GiphyController.php feat: complete AI assistant with custom services and brand config 2026-04-16 09:25:08 -03:00
NotificationController.php refactor: code review fixes — policies, enums, data_get, tests 2026-03-31 00:40:18 -03:00
PostAiCreateController.php refactor: introduce VideoPreview component and standardize media handling across post previews 2026-05-08 18:30:11 -03:00
PostAiGenerateController.php refactor: introduce VideoPreview component and standardize media handling across post previews 2026-05-08 18:30:11 -03:00
PostAiReviewController.php feat: transition AI usage from feature-based limits to a centralized monthly credit system with token tracking. 2026-05-03 19:36:26 -03:00
PostCommentController.php feat: @mentions in comments, AI Action layer + MCP tools, settings tabs 2026-05-01 20:59:03 -03:00
PostController.php fix(facebook): empty-message rejection + state consistency + no re-publish on terminal 2026-05-19 12:47:18 -03:00
PostTemplateController.php refactor: drop RenderedSlide DTO and content_language null fallbacks 2026-05-08 19:32:51 -03:00
PresenceController.php feat: @mentions in comments, AI Action layer + MCP tools, settings tabs 2026-05-01 20:59:03 -03:00
UnsplashController.php feat: complete AI assistant with custom services and brand config 2026-04-16 09:25:08 -03:00
WorkspaceController.php feat: AI image generation pipeline and post creation overhaul 2026-05-08 13:38:30 -03:00
WorkspaceInviteController.php refactor: reorganize settings UI, migrate post templates to a file-based registry, and remove legacy video generation features 2026-05-03 13:44:13 -03:00
WorkspaceLabelController.php refactor: code review fixes — policies, enums, data_get, tests 2026-03-31 00:40:18 -03:00
WorkspaceSignatureController.php chore: remove deprecated localization files 2026-05-03 15:23:25 -03:00