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();