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
test,refactor: review fixes for per-platform meta parity
Paulo Castellano40425d7bdce6
diff --git a/app/Http/Requests/Api/Post/UpdatePostRequest.php b/app/Http/Requests/Api/Post/UpdatePostRequest.phpindex 02fa34d00..7d3ef18ed 100644--- a/app/Http/Requests/Api/Post/UpdatePostRequest.php+++ b/app/Http/Requests/Api/Post/UpdatePostRequest.php@@ -68,7 +68,7 @@ class UpdatePostRequest extends FormRequestpublic function withValidator(Validator $validator): void{- $validator->after(function ($validator): void {+ $validator->after(function (Validator $validator): void {if (! in_array($this->input('status'), [Status::Scheduled->value, Status::Publishing->value], true)) {return;}diff --git a/tests/Feature/Api/PostApiPlatformMetaTest.php b/tests/Feature/Api/PostApiPlatformMetaTest.phpindex f54f30d2d..4865df418 100644--- a/tests/Feature/Api/PostApiPlatformMetaTest.php+++ b/tests/Feature/Api/PostApiPlatformMetaTest.php@@ -43,9 +43,12 @@ it('persists Discord channel, mentions and embeds meta on store', function () {$meta = PostPlatform::where('social_account_id', $this->discordAccount->id)->sole()->meta;- expect($meta['channel_id'])->toBe('444555666')- ->and($meta['mentions'])->toHaveCount(1)- ->and($meta['embeds.0.title'] ?? data_get($meta, 'embeds.0.title'))->toBe('Release');+ // Assert nested keys survive validated() — the exact stripping bug this PR fixes.+ expect(data_get($meta, 'channel_id'))->toBe('444555666')+ ->and(data_get($meta, 'mentions.0.token'))->toBe('@everyone')+ ->and(data_get($meta, 'mentions.0.label'))->toBe('@everyone')+ ->and(data_get($meta, 'embeds.0.title'))->toBe('Release')+ ->and(data_get($meta, 'embeds.0.color'))->toBe('#5865F2');});it('persists per-platform meta across networks on store', function () {@@ -107,7 +110,7 @@ it('rejects publishing without TikTok privacy and Pinterest board', function ()['id' => $tiktokPlatform->id],],])- ->assertStatus(422)+ ->assertUnprocessable()->assertJsonValidationErrors(['platforms.0.meta.board_id','platforms.1.meta.privacy_level',@@ -128,7 +131,7 @@ it('rejects publishing a Discord post without a channel', function () {'status' => PostStatus::Publishing->value,'platforms' => [['id' => $platform->id]],])- ->assertStatus(422)+ ->assertUnprocessable()->assertJsonValidationErrors(['platforms.0.meta.channel_id']);});diff --git a/tests/Feature/Mcp/PostPlatformMetaToolTest.php b/tests/Feature/Mcp/PostPlatformMetaToolTest.phpindex 5b215393c..43f6ee261 100644--- a/tests/Feature/Mcp/PostPlatformMetaToolTest.php+++ b/tests/Feature/Mcp/PostPlatformMetaToolTest.php@@ -130,6 +130,33 @@ test('publish post rejects a Discord platform without a channel', function () {$response->assertHasErrors([__('posts.form.discord.channel_required')]);});+test('publish guard enforces required meta for TikTok and Pinterest', function (string $factoryState, string $field, string $messageKey) {+ $account = SocialAccount::factory()->create([+ 'workspace_id' => $this->workspace->id,+ 'platform' => $factoryState === 'tiktok' ? Platform::TikTok : Platform::Pinterest,+ ]);++ $post = Post::factory()->create([+ 'workspace_id' => $this->workspace->id,+ 'user_id' => $this->user->id,+ 'status' => PostStatus::Draft,+ ]);+ PostPlatform::factory()->{$factoryState}()->create([+ 'post_id' => $post->id,+ 'social_account_id' => $account->id,+ 'enabled' => true,+ 'meta' => [],+ ]);++ $response = TryPostServer::actingAs($this->user)+ ->tool(PublishPostTool::class, ['post_id' => $post->id]);++ $response->assertHasErrors([__($messageKey)]);+})->with([+ 'tiktok' => ['tiktok', 'privacy_level', 'posts.form.tiktok.privacy_required'],+ 'pinterest' => ['pinterest', 'board_id', 'posts.form.pinterest.board_required'],+]);+test('publish post succeeds for a Discord platform with a channel', function () {Queue::fake();