trypost/app
Paulo Castellano 620d23187e fix(social): handle TokenExpired status fail-fast and notify user
Three related fixes for the failure mode where a scheduled post errors out
as 'An unknown X error occurred.' when a social account's refresh_token
was already invalidated by the provider:

1. **PublishToSocialPlatform**: fail-fast when account status is
   `TokenExpired`. Previously the job tried to publish, the publisher
   internally tried to refresh, the provider rejected the rotated
   refresh_token, and the failure surfaced as a generic 'unknown' error
   instead of a clear 'reconnect your account' signal.

2. **XPublisher::refreshToken**: when the OAuth endpoint rejects the
   refresh_token (typically because it was rotated/revoked at X), log the
   raw response and throw `TokenExpiredException` instead of falling
   through to `XPublishException::fromApiResponse` which expects the
   tweet-API response shape (`type`/`title`/`detail`) and treats
   OAuth-style responses (`error`/`error_description`) as 'Unknown'.

3. **SocialAccount::markAsTokenExpired**: dispatch an in-app + email
   notification (`Type::AccountDisconnected`) when an account
   transitions from `Connected` → `TokenExpired`, mirroring the
   existing pattern in `markAsDisconnected`. Wrapped in a lock to
   prevent duplicate notifications on concurrent transitions. Accepts an
   optional `notify: false` so the batch verifier
   (`VerifyWorkspaceConnections`) can suppress per-account
   notifications and rely on its summary email.
2026-05-12 18:46:06 -03:00
..
Actions feat: workspace-scoped broadcast channel and post lifecycle events 2026-05-07 16:02:22 -03:00
Ai/Agents chore: remove unused Gemini provider extension and debug middleware 2026-05-11 21:24:11 -03:00
Broadcasting refactor: introduce VideoPreview component and standardize media handling across post previews 2026-05-08 18:30:11 -03:00
Concerns refactor: settings redesign, Spanish translations, language system, strict_types 2026-03-30 00:20:43 -03:00
Console/Commands 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
DataTransferObjects feat: AI image generation pipeline and post creation overhaul 2026-05-08 13:38:30 -03:00
Enums refactor(posts): tighten content-length caps and simplify contentOverflow 2026-05-11 20:06:44 -03:00
Events refactor: prefer string interpolation over concatenation for channel names 2026-05-08 19:22:01 -03:00
Exceptions feat: @mentions in comments, AI Action layer + MCP tools, settings tabs 2026-05-01 20:59:03 -03:00
Features 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
Helpers fix: correct Upload.php filename case for Linux CI 2026-03-31 12:01:48 -03:00
Http fix(billing): widen tracking exception catch so post-payment page never crashes 2026-05-12 13:38:37 -03:00
Jobs fix(social): handle TokenExpired status fail-fast and notify user 2026-05-12 18:46:06 -03:00
Listeners chore: drop unused SubscriptionCreated event 2026-05-07 16:02:36 -03:00
Mail feat: @mentions in comments, AI Action layer + MCP tools, settings tabs 2026-05-01 20:59:03 -03:00
Mcp refactor(posts): tighten content-length caps and simplify contentOverflow 2026-05-11 20:06:44 -03:00
Models fix(social): handle TokenExpired status fail-fast and notify user 2026-05-12 18:46:06 -03:00
Policies refactor: move workspace tenancy check on Post into PostPolicy 2026-05-04 13:20:52 -03:00
Providers chore: remove unused Gemini provider extension and debug middleware 2026-05-11 21:24:11 -03:00
Rules refactor(posts): tighten content-length caps and simplify contentOverflow 2026-05-11 20:06:44 -03:00
Services fix(social): handle TokenExpired status fail-fast and notify user 2026-05-12 18:46:06 -03:00
Socialite refactor: centralize social API base URLs into the configuration file to improve maintainability and environment flexibility 2026-05-02 13:49:20 -03:00
Support feat: AI image generation pipeline and post creation overhaul 2026-05-08 13:38:30 -03:00