trypost/app/Jobs
Paulo Castellano 32e1f89adb fix(social): publish flow honors PlatformUnavailable too
The previous commits in this PR closed the loophole on the hourly /
daily token-refresh jobs. The same loophole remained on the publish
path: every per-platform publisher (LinkedIn, X, YouTube, TikTok,
Threads, Instagram, Pinterest, Bluesky and their Analytics siblings)
has its own refreshToken() called before publishing a scheduled post,
and all of those treated any non-2xx as TokenExpired — including 5xx.

Result before this commit: a Bluesky outage that coincided with a
scheduled publish would mark the account as expired and fail the post.

Changes:
- Route every refreshToken() in the 16 publisher / analytics classes
  through TokenRefreshClient::for(Platform::X)->send(...).
- TokenRefreshClient now also fills platformErrorCode from the HTTP
  status and pulls error_description / error.message from the JSON
  body, preserving the richer info LinkedIn / X / TikTok / Pinterest /
  Threads used to put on their TokenExpiredException.
- PublishToSocialPlatform catches PlatformUnavailableException
  explicitly: the post is marked failed (category: platform_unavailable,
  with http_status in error_context) but the account stays Connected.
  No retry inside this job — the scheduler reattempts the next run.

Test added: publish flow does NOT mark account expired when the
publisher throws PlatformUnavailable. Full suite: 1569 passing.
2026-05-19 09:01:02 -03:00
..
Ai refactor: drop RenderedSlide DTO and content_language null fallbacks 2026-05-08 19:32:51 -03:00
PostHog chore: drop verbose docblocks across PostHog and billing files 2026-05-07 16:03:12 -03:00
PublishPost.php fix: withoutOverlapping on schedules, publisher token refresh lock, PublishPost tries:1, TokenExpired allows publish, API validation scoping 2026-04-01 12:49:01 -03:00
PublishToSocialPlatform.php fix(social): publish flow honors PlatformUnavailable too 2026-05-19 09:01:02 -03:00
RefreshSocialToken.php fix(social): move Mastodon default instance to config + cleanup 2026-05-19 08:27:46 -03:00
SendNotification.php feat: @mentions in comments, AI Action layer + MCP tools, settings tabs 2026-05-01 20:59:03 -03:00
VerifyWorkspaceConnections.php fix(social): move Mastodon default instance to config + cleanup 2026-05-19 08:27:46 -03:00