Open-source social media scheduler built for AI agents and the teams behind them. Create, schedule and publish posts to every network through MCP or the REST API, or write them yourself in a composer your team will love.
PHP ai-agentsblueskyfacebookinstagramlaravellinkedinmastodonmcpmcp-serveropen-sourcerest-apiself-hostedsocial-mediasocial-media-managementsocial-media-schedulerthreadstiktokvuejsxyoutube
refactor(social): drop redundant \$account->refresh() after CV refresh
Paulo Castellano6c6078fa6a4a
diff --git a/app/Services/Social/BlueskyPublisher.php b/app/Services/Social/BlueskyPublisher.phpindex bc7a5b65f..38094fc6e 100644--- a/app/Services/Social/BlueskyPublisher.php+++ b/app/Services/Social/BlueskyPublisher.php@@ -30,7 +30,6 @@ class BlueskyPublisher// Refresh token if neededif ($account->is_token_expired || $account->is_token_expiring_soon) {app(ConnectionVerifier::class)->refreshToken($account);- $account->refresh();}$medias = $postPlatform->post->mediaItems;diff --git a/app/Services/Social/ConnectionVerifier.php b/app/Services/Social/ConnectionVerifier.phpindex a0b25dfb1..7f25319fa 100644--- a/app/Services/Social/ConnectionVerifier.php+++ b/app/Services/Social/ConnectionVerifier.php@@ -99,9 +99,8 @@ class ConnectionVerifierPlatform::Pinterest => $this->refreshPinterestToken($account),Platform::Threads => $this->refreshThreadsToken($account),Platform::Instagram => $this->refreshInstagramToken($account),- // InstagramFacebook uses page tokens that don't expire (like Facebook)- // Mastodon tokens don't expire- // Mastodon tokens don't expire+ // Facebook / InstagramFacebook use Page tokens that don't expire.+ // Mastodon tokens don't expire either.default => null,};} finally {diff --git a/app/Services/Social/InstagramAnalytics.php b/app/Services/Social/InstagramAnalytics.phpindex de677310e..50c20c889 100644--- a/app/Services/Social/InstagramAnalytics.php+++ b/app/Services/Social/InstagramAnalytics.php@@ -46,7 +46,6 @@ class InstagramAnalyticsif ($account->is_token_expired || $account->is_token_expiring_soon) {app(ConnectionVerifier::class)->refreshToken($account);- $account->refresh();}$this->accessToken = $account->access_token;@@ -90,7 +89,6 @@ class InstagramAnalyticsif ($account->is_token_expired || $account->is_token_expiring_soon) {app(ConnectionVerifier::class)->refreshToken($account);- $account->refresh();}$this->accessToken = $account->access_token;diff --git a/app/Services/Social/InstagramPublisher.php b/app/Services/Social/InstagramPublisher.phpindex d4da82740..c22bef71a 100644--- a/app/Services/Social/InstagramPublisher.php+++ b/app/Services/Social/InstagramPublisher.php@@ -31,7 +31,6 @@ class InstagramPublisherif ($account->is_token_expired || $account->is_token_expiring_soon) {app(ConnectionVerifier::class)->refreshToken($account);- $account->refresh();}$instagramId = $account->platform_user_id;diff --git a/app/Services/Social/LinkedInPageAnalytics.php b/app/Services/Social/LinkedInPageAnalytics.phpindex 3fdba5499..71fb4355a 100644--- a/app/Services/Social/LinkedInPageAnalytics.php+++ b/app/Services/Social/LinkedInPageAnalytics.php@@ -52,7 +52,6 @@ class LinkedInPageAnalyticsif ($account->is_token_expired || $account->is_token_expiring_soon) {app(ConnectionVerifier::class)->refreshToken($account);- $account->refresh();}// platform_post_id is the share URN (e.g., "urn:li:share:12345").@@ -82,7 +81,6 @@ class LinkedInPageAnalytics{if ($account->is_token_expired || $account->is_token_expiring_soon) {app(ConnectionVerifier::class)->refreshToken($account);- $account->refresh();}$this->accessToken = $account->access_token;diff --git a/app/Services/Social/LinkedInPagePublisher.php b/app/Services/Social/LinkedInPagePublisher.phpindex 8269a21b5..c1a186f6e 100644--- a/app/Services/Social/LinkedInPagePublisher.php+++ b/app/Services/Social/LinkedInPagePublisher.php@@ -47,7 +47,6 @@ class LinkedInPagePublisherif ($this->account->is_token_expired || $this->account->is_token_expiring_soon) {app(ConnectionVerifier::class)->refreshToken($this->account);- $this->account->refresh();}$this->accessToken = $this->account->access_token;@@ -82,7 +81,6 @@ class LinkedInPagePublishertry {app(ConnectionVerifier::class)->refreshToken($this->account);- $this->account->refresh();$this->accessToken = $this->account->access_token;$organizationId = $this->account->meta['organization_id'] ?? null;diff --git a/app/Services/Social/LinkedInPublisher.php b/app/Services/Social/LinkedInPublisher.phpindex 567bf1e03..8053d4588 100644--- a/app/Services/Social/LinkedInPublisher.php+++ b/app/Services/Social/LinkedInPublisher.php@@ -47,7 +47,6 @@ class LinkedInPublisherif ($this->account->is_token_expired || $this->account->is_token_expiring_soon) {app(ConnectionVerifier::class)->refreshToken($this->account);- $this->account->refresh();}$this->accessToken = $this->account->access_token;@@ -76,7 +75,6 @@ class LinkedInPublishertry {app(ConnectionVerifier::class)->refreshToken($this->account);- $this->account->refresh();$this->accessToken = $this->account->access_token;$personUrn = "urn:li:person:{$this->account->platform_user_id}";diff --git a/app/Services/Social/PinterestAnalytics.php b/app/Services/Social/PinterestAnalytics.phpindex d18391a43..082963a24 100644--- a/app/Services/Social/PinterestAnalytics.php+++ b/app/Services/Social/PinterestAnalytics.php@@ -48,7 +48,6 @@ class PinterestAnalyticsif ($account->is_token_expired || $account->is_token_expiring_soon) {app(ConnectionVerifier::class)->refreshToken($account);- $account->refresh();}$start = now()->subDays(90)->format('Y-m-d');@@ -93,7 +92,6 @@ class PinterestAnalytics{if ($account->is_token_expired || $account->is_token_expiring_soon) {app(ConnectionVerifier::class)->refreshToken($account);- $account->refresh();}$this->accessToken = $account->access_token;diff --git a/app/Services/Social/PinterestPublisher.php b/app/Services/Social/PinterestPublisher.phpindex 5fe1d7b33..994199fa5 100644--- a/app/Services/Social/PinterestPublisher.php+++ b/app/Services/Social/PinterestPublisher.php@@ -35,7 +35,6 @@ class PinterestPublisherif ($account->is_token_expired || $account->is_token_expiring_soon) {app(ConnectionVerifier::class)->refreshToken($account);- $account->refresh();}$content = $postPlatform->post->content ? app(ContentSanitizer::class)->sanitize($postPlatform->post->content, $postPlatform->platform) : null;@@ -407,7 +406,6 @@ class PinterestPublisher{if ($account->is_token_expired || $account->is_token_expiring_soon) {app(ConnectionVerifier::class)->refreshToken($account);- $account->refresh();}$response = $this->socialHttp()->withToken($account->access_token)diff --git a/app/Services/Social/ThreadsAnalytics.php b/app/Services/Social/ThreadsAnalytics.phpindex 262589795..ef196477e 100644--- a/app/Services/Social/ThreadsAnalytics.php+++ b/app/Services/Social/ThreadsAnalytics.php@@ -48,7 +48,6 @@ class ThreadsAnalyticsif ($account->is_token_expired || $account->is_token_expiring_soon) {app(ConnectionVerifier::class)->refreshToken($account);- $account->refresh();}$response = $this->socialHttp()@@ -80,7 +79,6 @@ class ThreadsAnalytics{if ($account->is_token_expired || $account->is_token_expiring_soon) {app(ConnectionVerifier::class)->refreshToken($account);- $account->refresh();}$this->accessToken = $account->access_token;diff --git a/app/Services/Social/ThreadsPublisher.php b/app/Services/Social/ThreadsPublisher.phpindex 28d3d19ab..c37402f18 100644--- a/app/Services/Social/ThreadsPublisher.php+++ b/app/Services/Social/ThreadsPublisher.php@@ -31,7 +31,6 @@ class ThreadsPublisherif ($account->is_token_expired || $account->is_token_expiring_soon) {app(ConnectionVerifier::class)->refreshToken($account);- $account->refresh();}$userId = $account->platform_user_id;diff --git a/app/Services/Social/TikTokAnalytics.php b/app/Services/Social/TikTokAnalytics.phpindex a1a80d634..378619783 100644--- a/app/Services/Social/TikTokAnalytics.php+++ b/app/Services/Social/TikTokAnalytics.php@@ -37,7 +37,6 @@ class TikTokAnalytics{if ($account->is_token_expired || $account->is_token_expiring_soon) {app(ConnectionVerifier::class)->refreshToken($account);- $account->refresh();}$this->accessToken = $account->access_token;diff --git a/app/Services/Social/TikTokCreatorInfo.php b/app/Services/Social/TikTokCreatorInfo.phpindex 418316bd0..7571d0672 100644--- a/app/Services/Social/TikTokCreatorInfo.php+++ b/app/Services/Social/TikTokCreatorInfo.php@@ -60,7 +60,6 @@ class TikTokCreatorInfo{if ($account->is_token_expired || $account->is_token_expiring_soon) {app(ConnectionVerifier::class)->refreshToken($account);- $account->refresh();}$this->accessToken = $account->access_token;diff --git a/app/Services/Social/TikTokPublisher.php b/app/Services/Social/TikTokPublisher.phpindex 554e3402e..d26a8a8a2 100644--- a/app/Services/Social/TikTokPublisher.php+++ b/app/Services/Social/TikTokPublisher.php@@ -37,7 +37,6 @@ class TikTokPublisherif ($account->is_token_expired || $account->is_token_expiring_soon) {app(ConnectionVerifier::class)->refreshToken($account);- $account->refresh();}$this->accessToken = $account->access_token;diff --git a/app/Services/Social/XAnalytics.php b/app/Services/Social/XAnalytics.phpindex 1b22c7e98..c562b2a89 100644--- a/app/Services/Social/XAnalytics.php+++ b/app/Services/Social/XAnalytics.php@@ -48,7 +48,6 @@ class XAnalytics{if ($account->is_token_expired || $account->is_token_expiring_soon) {app(ConnectionVerifier::class)->refreshToken($account);- $account->refresh();}$this->accessToken = $account->access_token;@@ -164,7 +163,6 @@ class XAnalyticsif ($account->is_token_expired || $account->is_token_expiring_soon) {app(ConnectionVerifier::class)->refreshToken($account);- $account->refresh();}$this->accessToken = $account->access_token;diff --git a/app/Services/Social/XPublisher.php b/app/Services/Social/XPublisher.phpindex fefdda530..625a840b4 100644--- a/app/Services/Social/XPublisher.php+++ b/app/Services/Social/XPublisher.php@@ -38,7 +38,6 @@ class XPublisher// Refresh token if expired or expiring soonif ($account->is_token_expired || $account->is_token_expiring_soon) {app(ConnectionVerifier::class)->refreshToken($account);- $account->refresh();}$this->accessToken = $account->access_token;diff --git a/app/Services/Social/YouTubeAnalytics.php b/app/Services/Social/YouTubeAnalytics.phpindex 43d012481..c4eb83423 100644--- a/app/Services/Social/YouTubeAnalytics.php+++ b/app/Services/Social/YouTubeAnalytics.php@@ -48,7 +48,6 @@ class YouTubeAnalyticsif ($account->is_token_expired || $account->is_token_expiring_soon) {app(ConnectionVerifier::class)->refreshToken($account);- $account->refresh();}$this->accessToken = $account->access_token;@@ -100,7 +99,6 @@ class YouTubeAnalytics{if ($account->is_token_expired || $account->is_token_expiring_soon) {app(ConnectionVerifier::class)->refreshToken($account);- $account->refresh();}$this->accessToken = $account->access_token;diff --git a/app/Services/Social/YouTubePublisher.php b/app/Services/Social/YouTubePublisher.phpindex b3a68fd6b..5b4467c57 100644--- a/app/Services/Social/YouTubePublisher.php+++ b/app/Services/Social/YouTubePublisher.php@@ -35,7 +35,6 @@ class YouTubePublisherif ($account->is_token_expired || $account->is_token_expiring_soon) {app(ConnectionVerifier::class)->refreshToken($account);- $account->refresh();}$media = $postPlatform->post->mediaItems;