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
fix: skip publishing when social account is disconnected
Paulo Castellano39302564de1f
diff --git a/app/Jobs/PublishToSocialPlatform.php b/app/Jobs/PublishToSocialPlatform.phpindex 319b1effd..e84a5ace7 100644--- a/app/Jobs/PublishToSocialPlatform.php+++ b/app/Jobs/PublishToSocialPlatform.php@@ -33,6 +33,14 @@ class PublishToSocialPlatform implements ShouldQueuepublic function handle(): void{+ if ($this->postPlatform->socialAccount->isDisconnected()) {+ $this->postPlatform->markAsFailed('Social account is disconnected');+ $this->updatePostStatus();+ $this->broadcastStatus();++ return;+ }+$this->postPlatform->markAsPublishing();$this->broadcastStatus();diff --git a/tests/Feature/Jobs/PublishToSocialPlatformTest.php b/tests/Feature/Jobs/PublishToSocialPlatformTest.phpindex 189012aba..8c3319d97 100644--- a/tests/Feature/Jobs/PublishToSocialPlatformTest.php+++ b/tests/Feature/Jobs/PublishToSocialPlatformTest.php@@ -156,3 +156,42 @@ test('publish to social platform marks post as failed when all platforms fail',$this->post->refresh();expect($this->post->status)->toBe(PostStatus::Failed);});++test('publish to social platform skips publishing when account is disconnected', function () {+ Event::fake();++ $this->socialAccount->update([+ 'status' => AccountStatus::Disconnected,+ 'disconnected_at' => now(),+ ]);++ $publisher = Mockery::mock(LinkedInPublisher::class);+ $publisher->shouldNotReceive('publish');++ $this->app->instance(LinkedInPublisher::class, $publisher);++ (new PublishToSocialPlatform($this->postPlatform))->handle();++ $this->postPlatform->refresh();+ expect($this->postPlatform->status)->toBe('failed');+ expect($this->postPlatform->error_message)->toBe('Social account is disconnected');+});++test('publish to social platform skips publishing when account token is expired', function () {+ Event::fake();++ $this->socialAccount->update([+ 'status' => AccountStatus::TokenExpired,+ ]);++ $publisher = Mockery::mock(LinkedInPublisher::class);+ $publisher->shouldNotReceive('publish');++ $this->app->instance(LinkedInPublisher::class, $publisher);++ (new PublishToSocialPlatform($this->postPlatform))->handle();++ $this->postPlatform->refresh();+ expect($this->postPlatform->status)->toBe('failed');+ expect($this->postPlatform->error_message)->toBe('Social account is disconnected');+});