From d8e43bcfbb18d9b991f64e1a4340a0c844be904a Mon Sep 17 00:00:00 2001 From: Paulo Castellano Date: Fri, 24 Jul 2026 22:54:20 -0300 Subject: [PATCH] Unwrap Pinterest board lists for the web editors. getBoards now returns {boards, truncated}; pass only the boards array into Inertia pinterestBoards so post and automation pickers keep receiving an array. Co-authored-by: Cursor --- .../Automation/Automation/GetAutomationEditorData.php | 6 +++++- app/Http/Controllers/App/PostController.php | 6 +++++- tests/Feature/Automation/Automation/ReadActionsTest.php | 5 ++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/app/Actions/Automation/Automation/GetAutomationEditorData.php b/app/Actions/Automation/Automation/GetAutomationEditorData.php index 157e4ee1..e633b77b 100644 --- a/app/Actions/Automation/Automation/GetAutomationEditorData.php +++ b/app/Actions/Automation/Automation/GetAutomationEditorData.php @@ -34,7 +34,11 @@ public function __invoke(Automation $automation): array ->where('platform', Platform::Pinterest) ->mapWithKeys(fn ($account) => [ $account->id => rescue( - fn () => $this->pinterestPublisher->getBoards($account), + fn () => data_get( + $this->pinterestPublisher->getBoards($account), + 'boards', + [], + ), [], report: false, ), diff --git a/app/Http/Controllers/App/PostController.php b/app/Http/Controllers/App/PostController.php index 7ef6f633..544d6dcc 100644 --- a/app/Http/Controllers/App/PostController.php +++ b/app/Http/Controllers/App/PostController.php @@ -260,7 +260,11 @@ public function edit(Request $request, Post $post): Response|RedirectResponse ->where('platform', Platform::Pinterest) ->mapWithKeys(fn ($account) => [ $account->id => rescue( - fn () => app(PinterestPublisher::class)->getBoards($account), + fn () => data_get( + app(PinterestPublisher::class)->getBoards($account), + 'boards', + [], + ), [], report: false, ), diff --git a/tests/Feature/Automation/Automation/ReadActionsTest.php b/tests/Feature/Automation/Automation/ReadActionsTest.php index dd967505..24b6e4c2 100644 --- a/tests/Feature/Automation/Automation/ReadActionsTest.php +++ b/tests/Feature/Automation/Automation/ReadActionsTest.php @@ -135,7 +135,10 @@ }); it('maps pinterest boards for pinterest accounts', function () { - $this->mock(PinterestPublisher::class, fn ($mock) => $mock->shouldReceive('getBoards')->andReturn([['id' => 'b1']])); + $this->mock(PinterestPublisher::class, fn ($mock) => $mock->shouldReceive('getBoards')->andReturn([ + 'boards' => [['id' => 'b1']], + 'truncated' => false, + ])); $this->mock(TikTokCreatorInfo::class); $workspace = Workspace::factory()->create();