trypost/tests/Feature
Paulo Castellano 3dd1804c8e Stop publishers/analytics from rotating still-valid tokens
Every publisher and analytics service proactively refreshed the token when
it was expired OR merely "expiring soon" (within 15 min), calling
refreshToken() directly. For X (and other single-use-refresh providers)
that rotated a perfectly valid access_token whenever an operation ran in the
token's final 15 minutes — the same needless rotation that breaks the
refresh_token chain and disconnects accounts.

Narrow every pre-check to refresh only when the token is actually expired. A
still-valid token is used as-is; if it expires mid-operation the existing
reactive retry (PublishToSocialPlatform) refreshes and retries.

- Drop `|| is_token_expiring_soon` from all 23 publisher/analytics pre-checks.
- Remove the now-unused `isTokenExpiringSoon` accessor (no references remain
  anywhere in the repo).
- The reactive retry path (AbstractLinkedInPublisher::retryWithRefresh) and
  the expired-token path are unchanged.

Refs #126
2026-07-03 08:30:58 -03:00
..
Actions fix(workspace): default content_language to the app locale, not 'en' 2026-07-01 13:49:48 -03:00
Ai refactor(ai): introduce GeneratorFormat enum and drop stringly-typed format 2026-06-18 11:11:23 -03:00
Api fix(media): treat any download failure (timeout/DNS/refused) as a failed fetch 2026-06-29 13:41:47 -03:00
Auth chore: remove unused Pennant package and dead user-timezone handling 2026-06-22 13:37:38 -03:00
Automation refactor(linkedin): infer post format from media + unify account connection 2026-06-24 21:05:09 -03:00
Billing fix: address PR review findings 2026-06-22 12:53:13 -03:00
Brand Structure brand voice and make generated copy platform-aware 2026-06-12 17:09:39 -03:00
Commands Fix X token chain breaking from over-rotation 2026-07-02 20:32:55 -03:00
Database test(auth): cover remaining surfaces of the registration gate 2026-05-19 12:03:41 -03:00
Discord fix(channels): restrict Discord picker to postable channels the bot can use 2026-06-16 16:34:02 -03:00
Image Harden automations module: full-post generation, reliable runs, editor UX 2026-06-10 20:45:01 -03:00
Jobs Fix X token chain breaking from over-rotation 2026-07-02 20:32:55 -03:00
Listeners chore: remove legacy plan tiers (starter/plus/pro/max) 2026-06-22 15:31:32 -03:00
Mcp refactor(linkedin): infer post format from media + unify account connection 2026-06-24 21:05:09 -03:00
Middleware fix(linkedin): enforce carousel cap and fail loudly on processing timeout 2026-06-25 15:34:03 -03:00
Migrations refactor(linkedin): infer post format from media + unify account connection 2026-06-24 21:05:09 -03:00
Models refactor(billing): replace MonthlyCreditsLimit Pennant feature with BillingCycle 2026-06-22 09:55:03 -03:00
Observers feat(posthog): keep social_accounts_count and posts_count fresh on account group 2026-05-15 18:40:07 -03:00
Onboarding fix(tracking): fire begin_checkout when onboarding checkout starts 2026-07-02 09:21:31 -03:00
Permissions fix(permissions): address code-review findings 2026-06-22 18:00:36 -03:00
Services Stop publishers/analytics from rotating still-valid tokens 2026-07-03 08:30:58 -03:00
Settings fix(profile): member delete must not destroy the shared account (closes #50) 2026-05-19 12:20:49 -03:00
Social refactor(auth): split workspace gate into EnsureHasWorkspace middleware 2026-06-25 14:30:15 -03:00
SocialAccount fix: merge-readiness — close two billing/network bugs, harden tests 2026-06-22 09:26:31 -03:00
Workspace feat: @mentions in comments, AI Action layer + MCP tools, settings tabs 2026-05-01 20:59:03 -03:00
AcceptInviteControllerTest.php fix(members): preserve invited role on accept and surface viewer in role menu 2026-06-22 14:24:19 -03:00
AccountControllerTest.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
AiUsageLogTest.php feat: per-workspace pricing, onboarding, and billing overhaul 2026-06-21 20:40:03 -03:00
ApiKeyControllerTest.php feat: migrate custom API token implementation to Laravel Passport for authentication and token management 2026-05-03 18:38:17 -03:00
AssetControllerTest.php feat(linkedin): support PDF document (carousel) posts 2026-06-24 16:32:27 -03:00
BillingControllerTest.php refactor: address code review for per-workspace pricing 2026-06-21 21:28:47 -03:00
ExampleTest.php refactor: settings redesign, Spanish translations, language system, strict_types 2026-03-30 00:20:43 -03:00
GitHubAuthToggleTest.php feat(auth): self-hosted registration gate + admin seeder (closes #46) 2026-05-19 11:45:16 -03:00
GoogleAuthToggleTest.php feat(auth): self-hosted registration gate + admin seeder (closes #46) 2026-05-19 11:45:16 -03:00
InstagramFacebookIntegrationTest.php feat: add PostCommentCreated broadcast event 2026-04-15 20:11:36 -03:00
InvitePermissionTest.php refactor: address code review for per-workspace pricing 2026-06-21 21:28:47 -03:00
NotificationControllerTest.php refactor: remove onboarding flow, implement brand analysis services, and replace setup middleware with account readiness checks 2026-04-16 23:05:51 -03:00
PlanSeederTest.php feat: per-workspace pricing, onboarding, and billing overhaul 2026-06-21 20:40:03 -03:00
PlanTest.php chore: remove legacy plan tiers (starter/plus/pro/max) 2026-06-22 15:31:32 -03:00
PostCommentControllerTest.php feat: @mentions in comments, AI Action layer + MCP tools, settings tabs 2026-05-01 20:59:03 -03:00
PostControllerTest.php Fix calendar showing 'no content' for every post 2026-06-02 09:16:16 -03:00
PostSearchTest.php refactor: remove onboarding flow, implement brand analysis services, and replace setup middleware with account readiness checks 2026-04-16 23:05:51 -03:00
PostTemplateControllerTest.php feat: pass and persist post dates through AI creation wizard and template application flows 2026-05-06 17:21:30 -03:00
SignupSuccessControllerTest.php refactor: code review fixes — policies, enums, data_get, tests 2026-03-31 00:40:18 -03:00
SocialAccountModelTest.php test(social-account): cover markAsDisconnected, notify flag, disconnected_at preservation, and i18n placeholder substitution 2026-05-12 19:17:16 -03:00
SocialAccountToggleTest.php refactor: remove onboarding flow, implement brand analysis services, and replace setup middleware with account readiness checks 2026-04-16 23:05:51 -03:00
SocialControllerTest.php fix(linkedin): show connected company page on the accounts and onboarding grids 2026-06-24 21:23:27 -03:00
SocialLoginControllerTest.php refactor: address third-pass review nits 2026-06-22 08:39:25 -03:00
TikTokI18nStringsTest.php fix(tiktok): align UX strings and render processing notice for app review 2026-05-29 10:16:04 -03:00
UpdatePostRequestTest.php feat(channels): add Discord as a social channel 2026-06-16 14:44:00 -03:00
UsageControllerTest.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
VerifyWorkspaceConnectionsTest.php fix(social): move Mastodon default instance to config + cleanup 2026-05-19 08:27:46 -03:00
WorkspaceBillingTest.php feat(onboarding): require connecting a social network before checkout 2026-06-22 12:31:44 -03:00
WorkspaceControllerTest.php refactor(social): address PR review follow-ups 2026-06-25 15:01:23 -03:00
WorkspaceInviteControllerTest.php fix(members): block self role-change/removal and lock role rules with tests 2026-06-22 14:41:11 -03:00
WorkspaceLabelControllerTest.php refactor: remove onboarding flow, implement brand analysis services, and replace setup middleware with account readiness checks 2026-04-16 23:05:51 -03:00
WorkspaceSignatureControllerTest.php chore: remove deprecated localization files 2026-05-03 15:23:25 -03:00
YouTubeAnalyticsTest.php refactor: remove onboarding flow, implement brand analysis services, and replace setup middleware with account readiness checks 2026-04-16 23:05:51 -03:00